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 .

 採用された回答

Walter Roberson
Walter Roberson 2017 年 12 月 25 日

0 投票

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

3 件のコメント

lotus whit
lotus whit 2017 年 12 月 25 日
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.
Walter Roberson
Walter Roberson 2017 年 12 月 25 日
save('m1.mat', '-struct', 'ds')
lotus whit
lotus whit 2017 年 12 月 26 日
編集済み: lotus whit 2017 年 12 月 26 日
Thanks it is working

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeWorkspace Variables and MAT Files についてさらに検索

タグ

質問済み:

2017 年 12 月 25 日

編集済み:

2017 年 12 月 26 日

Community Treasure Hunt

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

Start Hunting!

Translated by