MATLAB: Is there a way to save a .mat file with a variable as a filename MATLABsave Hello! I have a variable defined in my workspace. Example: sitename =US-FR2 How could I save a .mat file with this as the filename (US-FR2.mat), without typing it in manually? Mil gracias Best Answer save(sitename); Related SolutionsMATLAB: Can any body help me to creat .mat file in current folder I suppose you only want to save a specific variable instead of everything:If you would like to save only variable, a:a = rand(1,10)save('a_save.mat','a')If you would like to save all variables:filename = 'save_all.mat';save(filename) MATLAB: How to add sequential integers to .mat filename Can you just number them sequentially, like this?d = 3;dstr=num2str(d);n=1;name=strcat('d',dstr,'_',num2str(n))n = n+1; Related QuestionSaving workin space variableExtract Variable from FilenameSaving all of workspace in a specified folder.mat fileHow to save a string as a filename
Best Answer