Problem with saving a Matlab file

3 views (last 30 days)
Paola
Paola on 10 Feb 2022
Answered: Star Strider on 10 Feb 2022
Hi Guys,
My code shoud generate a mat lab file in which I have all the variables. Unfortunatly, I am not able to generate it correclty: Instead of having a .mat file I have a blank file without "termination" (not .mat). Can you help me to understand the problem?
basename=1ug
save([basename '_BTads']) . This is the line I use to save it
thanks

Answers (1)

Star Strider
Star Strider on 10 Feb 2022
Always supply the .mat extension yourself. MATLAB has no way of knowing otherwise, and assumes that what you assume is a file name is a variable that MATLAB can’t find.
See if:
save([basename '_BTads.mat'])
will do what you want. (This will save every variable in the current workspace, not selected variables, so specify them if you only wnat to save some of them.)
.

Community Treasure Hunt

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

Start Hunting!