Using sgtring as argument of save function
Show older comments
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)
Geoff Hayes
on 1 Feb 2015
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
Find more on File Operations 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!