How to save workspace except for one structure field?

조회 수: 1 (최근 30일)
Mohammad
Mohammad 2014년 4월 25일
편집: per isakson 2014년 7월 29일
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)$).');

답변 (1개)

pietro
pietro 2014년 4월 25일
편집: per isakson 2014년 7월 29일
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

카테고리

Help CenterFile Exchange에서 Structures에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by