Reputation: 718
Is it possible to save a file created in Matlab code to a place, specified in the filename I give the function that does the creation*, that is not in the hard drive or a flash drive, nor any other drive found in This PC (My Computer), but in the memory where the rest of the running program is found?
*such as save(filename,variable)
I'm hoping to refer to the files and then delete them as soon as the program is done, without encroaching on the user's hard drive.
After some web searching, I found this page, which solves a very similar problem in an unspecified OS as it was six years ago, but I
I want to make it possible to make a .exe out of my program, which currently saves files. While I'm sure I can delete them after creating them, I don't want to have the end product do anything that would alarm anyone of security risks while running this.
Upvotes: 0
Views: 605
Reputation: 24127
Perhaps you're over-thinking things? Maybe you could just save your files in the user's temporary directory. There are unlikely to be many security risks from doing that, and users are typically unalarmed by an application that does it.
If your application is written in MATLAB, you can get the name of the user's temporary directory with the command tempdir
, and you can generate a random name for a temporary file with the command tempname
.
Upvotes: 0