How to Save a File with a New Exetesion?
Show older comments
Imagine I have the variable below:
B = [1 2 3];
save(‘B’, ‘B’);
When I save variable B, MATLAB creates a file named B.mat. Is there any way to replace its extension with another word (e.g., B.FFF)? I want to do it to be able to find and sort files with such extension easier.
Accepted Answer
More Answers (1)
John D'Errico
on 16 Mar 2017
0 votes
Well, I suppose you could try. But then MATLAB would be unable to access that file, since it needs to be a .mat file. If the extension is not .mat, then MATLAB will assume the file is saved as a simple ascii text file.
Better is to put the tag into the name. B_FFF, or FFF_B. The latter is better, since a simple sort will bring all those names together, just as you wish.
Categories
Find more on Workspace Variables and MAT Files in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!