フィルターのクリア

How to list variables in save() as an array of strings

9 ビュー (過去 30 日間)
alex barrie
alex barrie 2017 年 12 月 7 日
コメント済み: alex barrie 2017 年 12 月 7 日
I want to save a list of vars to a mat file, but the list of vars is not known until run time, such as:
vars = ['a', 'b', 'c']; save('fname', vars)
Is this possible?

採用された回答

KL
KL 2017 年 12 月 7 日
use a cell array,
vars = {'a','b','c'};
and then,
save('dummy.mat',vars{:})
  2 件のコメント
Stephen23
Stephen23 2017 年 12 月 7 日
More information on this in the MATLAB documentation:
alex barrie
alex barrie 2017 年 12 月 7 日
The cell array worked, thanks!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCell Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by