Filter löschen
Filter löschen

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

9 Ansichten (letzte 30 Tage)
alex barrie
alex barrie am 7 Dez. 2017
Kommentiert: alex barrie am 7 Dez. 2017
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?

Akzeptierte Antwort

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

Weitere Antworten (0)

Kategorien

Mehr zu Cell Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by