フィルターのクリア

How to read and save different variables in a matfile to another mat file

2 ビュー (過去 30 日間)
sachin k p
sachin k p 2018 年 9 月 21 日
コメント済み: sachin k p 2018 年 9 月 25 日
How to read two specific variables from a .mat file having different variables and save it to another .mat file without changing the variable name.

採用された回答

Stephen23
Stephen23 2018 年 9 月 21 日
編集済み: Stephen23 2018 年 9 月 21 日
S = load('file1.mat','var1','var2');
save('file2.mat','-struct','S')
OR
S = load('file1.mat');
save('file2.mat','-struct','S','var1','var2')
  5 件のコメント
Stephen23
Stephen23 2018 年 9 月 24 日
@sachin k p: if the names are different then you could try the '-append' option, like this:
S = load('file1.mat','var1','var2');
save('file2.mat','-struct','S','-append')
sachin k p
sachin k p 2018 年 9 月 25 日
Thank you Stephen

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeWorkspace Variables and MAT-Files についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by