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

9 次查看(过去 30 天)
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?

采纳的回答

KL
KL 2017-12-7
use a cell array,
vars = {'a','b','c'};
and then,
save('dummy.mat',vars{:})

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Cell Arrays 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by