Borrar filtros
Borrar filtros

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

9 visualizaciones (últimos 30 días)
alex barrie
alex barrie el 7 de Dic. de 2017
Comentada: alex barrie el 7 de Dic. de 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?

Respuesta aceptada

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

Más respuestas (0)

Categorías

Más información sobre Cell Arrays en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by