Using sgtring as argument of save function

I'll be repeatedly running a code, and would like the "save" function to place the workspace variables into a file named after the date run, say 30JAN15, entered as a string at the top of the program. How do I pass that string to the save function?

Answers (1)

Michael - if there is a string input argument to your function, then you can use it in your save function as
function myFunc(filename)
% do some work
% save variables to file named filename
save(filename,'A','B','C');
where A, B, and C are the variables that you wish to save to file, and filename is the name of the file (something like '30JAN15').

Categories

Asked:

on 31 Jan 2015

Answered:

on 1 Feb 2015

Community Treasure Hunt

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

Start Hunting!