spreus
spreus

Reputation: 108

MATLAB-files with custom extensions

In MATLAB, I would like to be able to save (and re-open) MATLAB-files using a different extension than .mat (e.g. 'file.settings' / 'file.data' / etc.) so that, e.g., the file 'file.settings' is really a 'file.mat' in disguise.

How can this be accomplished?

Upvotes: 2

Views: 700

Answers (1)

Luis Mendo
Luis Mendo

Reputation: 112779

You can directly specify the file extension when calling save. Use either of these forms:

save filename.settings
save('filename.settings')

To load the file, since the extension is not known to Matlab, you must indicate that the format is actually that of a .mat file:

load filename.settings -mat
load('filename.settings','-mat')

Upvotes: 5

Related Questions