MATLAB: How to list variables in save() as an array of strings

.mat filesave

I want to save a list of vars to a mat file, but the list of vars is not known until run time, such as:
vars = ['a', 'b', 'c']; save('fname', vars)
Is this possible?

Best Answer

use a cell array,
vars = {'a','b','c'};
and then,
save('dummy.mat',vars{:})
Related Question