Could please help me , i have several m1.mat,m2.mat,......mn.mat ; i add new row for m1.mat then save if by typing save m1 or save Workspace , then i repeat these steps for m2 , but when i return back to use m1 , i found it has old values before changing .

 Akzeptierte Antwort

Walter Roberson
Walter Roberson am 25 Dez. 2017

0 Stimmen

ds = load('m1.mat');
ds.m1(end+1,:)=newdata;
save('m1.mat','ds','-struct')

3 Kommentare

lotus whit
lotus whit am 25 Dez. 2017
Thank you for your response, but i have this error: Error using save The -STRUCT option must be followed by the name of a scalar structure variable.
save('m1.mat', '-struct', 'ds')
lotus whit
lotus whit am 26 Dez. 2017
Bearbeitet: lotus whit am 26 Dez. 2017
Thanks it is working

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Community Treasure Hunt

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

Start Hunting!

Translated by