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?

回答(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').

类别

在 帮助中心 和 File Exchange 中查找有关 File Operations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by