How to save workspace except for one structure field?

1 visualización (últimos 30 días)
Mohammad
Mohammad el 25 de Abr. de 2014
Editada: per isakson el 29 de Jul. de 2014
I want to save the workspace except for a variable and a field in a structure.
I know i can do this to not save a variable, but i want to also not save struct.field
save('Workspace.mat','-regexp','^(?!(VariableName)$).');

Respuestas (1)

pietro
pietro el 25 de Abr. de 2014
Editada: per isakson el 29 de Jul. de 2014
Probably there is a shorter way to do it, but this method works:
a=1;
b=1;
c=1;
vars=who;
p=find(ismember(vars,'b')==0)
for i=1:length(p)
save('prova.mat',char(vars(p(i))));
end

Categorías

Más información sobre Structures 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