Is there a way to keep loaded data from a .mat file in computer memory for access by a standalone executable?

1 次查看(过去 30 天)
I'm trying to write a standalone executable that loads a bunch of data in the form of .mat files (steam tables, etc) once and keeps it in memory somewhere such that subsequent runs of the executable don't have to load the .mat files. Is that at all possible?
I can compile using mcc and attach the .mat files using the -a option but that loads the .mat file each time the executable is run.
Thanks,
Matthew

回答(2 个)

Arvind Narayanan
Arvind Narayanan 2017-3-28
Hi Matthew,
You could try packaging the MAT file along with the EXE during deployment. That way, it will always be accessible to the EXE within ctfroot ( ctfroot is the install folder of the EXE after deployment into a standalone system).
Alternatively, if the absolute location of the MAT file is known, you can mention the same when using the load command to load the MAT file. The following link contains a list of supported functions for deployment: Supported commands . You may refer to this while choosing the function that best meets your requirements.

Walter Roberson
Walter Roberson 2017-3-28
编辑:Walter Roberson 2017-3-28
You could look in the File Exchange at the Shared Matrix contribution. If you are on MS Windows you will need to alter the C code slightly (the shared memory segment calls are slightly different.)
The way you would use this is to have the process check to see if the shared matrix is available through its shared memory identifier. If it is, then go ahead and use it. If not, then launch a process which reads the files and makes them available through the shared memory segment.
Alternately, you could investigate the facilities of the MATLAB Production Server.

类别

Help CenterFile Exchange 中查找有关 Package MATLAB Functions 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by