the priority and benefits of saving data in .mat file

5 Ansichten (letzte 30 Tage)
farzad am 10 Okt. 2014
Hi All
I would like to know, why would it be beneficial to use .mat files to save data to when it's very hard to review them at any time, and should always be loaded and also it can be written to mfile directly
I appreciate your attention

Akzeptierte Antwort

Bruno Pop-Stefanov
Bruno Pop-Stefanov am 10 Okt. 2014
Bearbeitet: Bruno Pop-Stefanov am 10 Okt. 2014
MAT files are compressed, binary files used to store data on the computer's hard drive. It is a convenient way to save data for future use and for sharing.
You can see the contents of the MAT file without loading it in the memory. Simply click on the MAT file in the Current Folder browser and the contents will be displayed below.
You can also load only one variable from a MAT file containing several variables with a simple command, without needing to load the entire file:
>> load mymatfile.mat variable
You can add variables to a MAT file gradually, when a MAT file already exists and already contains data. There is no need to re-write everything from the beginning:
>> save mymatfile.mat variable
If you don't want to use MAT file, the other alternative is to write the data to a binary file or a text file using the fprintf or fwrite functions, but it is obviously not as convenient as using MAT file. You would have to write your own read and write routines and the files will not be compressed.
For more information, you can refer to the following documentation page, which lists functions and tutorials for dealing with variables and MAT files:

Weitere Antworten (0)


Mehr zu Workspace Variables and MAT-Files finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by