saving workspace variables individually?

5 ビュー (過去 30 日間)
Dave
Dave 2023 年 3 月 27 日
コメント済み: Les Beckham 2023 年 3 月 27 日
Hello
Is there a way to save the variables in the workspace separately?
Say the workspace contains 50 variables (all arrays of double) , is there a way to save those 50 variables separately instead of saving them in one mat file?

採用された回答

Les Beckham
Les Beckham 2023 年 3 月 27 日
a = 1;
b = 2;
c = 3;
vars = who
vars = 4×1 cell array
{'a' } {'b' } {'c' } {'cmdout'}
for v = 1:numel(vars)
save(sprintf('%s.mat', vars{v}), vars{v})
end
dir
. .. a.mat b.mat c.mat cmdout.mat
  2 件のコメント
Dave
Dave 2023 年 3 月 27 日
thanks!
Les Beckham
Les Beckham 2023 年 3 月 27 日
You are quite welcome.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFile Operations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by