If you are trying to save to a text file with column headers then really the best way is to fopen fprintf the headers fprintf the data and then fclose.
Save data matlab mat.
Access specific parts of a variable in a mat file using the mat file object.
By default matlab compresses the data it saves to mat files.
If you do not specify filename the save function saves to a file named matlab mat.
Matlab also uses unicode character encoding when saving character data.
For example you can save data to a subset of a variable in a mat file or read a subset of a variable into the matlab workspace.
Specify the v6 option if you want to disable both of these features for a particular save operation.
Name of file specified as a character vector or string scalar.
If filename has no extension that is no period followed by text and the value of format is not specified then matlab appends mat if filename does not include a full path matlab saves to the current folder.
The workspace is not maintained across sessions of matlab when you quit matlab the workspace clears.
Save data to a subset of a variable y in the file myfile2 mat using the mat file object.
However you can save any or all the variables in the current workspace to a mat file mat you can then reuse the workspace variables later during the current matlab session or during another session by loading the saved mat file.
Data compression is optional however and you can disable it either for an individual save operation or for all of your matlab sessions.
Matlab compresses the data that you save to a mat file.
Once you had created the table described there you can save it to a mat file.
Save and load workspace variables.