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

2 vues (au cours des 30 derniers jours)
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

Réponses (2)

Arvind Narayanan
Arvind Narayanan le 28 Mar 2017
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 le 28 Mar 2017
Modifié(e) : Walter Roberson le 28 Mar 2017
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.

Catégories

En savoir plus sur Standalone Applications dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by