Loading and unloading data files
Mostra commenti meno recenti
In the applications I'm working on I typically store information in .mat files which I then load several times throughout the application. I don't like passing this data through global variables so I end up loading the data several times. My question is does this data get saved into memory each time? Or does each load remove the previous version in memory? Additionally, do I need to close the file somehow?
Thanks, Jeff
Risposta accettata
Più risposte (1)
per isakson
il 31 Mag 2013
0 voti
"does this data get saved into memory each time". I'm not sure I understand correctly. The system cache is affected and data are written to disk.
"Or does each load remove the previous version in memory?". The values of the Matlab variables are replaced each time. If the data are still in system cache that is used otherwise data are read from disk.
No, you don't need (and cannot) close the file explicitly.
Are you aware save( .... , '-v6' ) is faster?
Categorie
Scopri di più su Structures in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!