I have a series of matrices like A1,A2,A3,A4.
I want to save them into txt files named like file1, file2, file3, file4 respectively.

 採用された回答

Jan
Jan 2018 年 11 月 30 日

0 投票

It is a very bad idea to create variables with indices hidden in the name, see TUTORIAL: How to avoid Eval .
If the variables are store in a cell like A{1}, A{2}, ... the saving works easily using a loop:
for iA = 1:numel(A)
filename = sprintf('file%d.txt', iA);
dlmwrite(filename, A{iA});
end

その他の回答 (1 件)

KSSV
KSSV 2018 年 11 月 30 日

0 投票

REad about dlmwrite, save

カテゴリ

ヘルプ センター および File Exchange で Structures についてさらに検索

質問済み:

2018 年 11 月 30 日

コメント済み:

2018 年 12 月 1 日

Community Treasure Hunt

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

Start Hunting!

Translated by