How can I write a magic(5) matrix to a text file with special delimiters?

1 ビュー (過去 30 日間)
ARAH MIZORI
ARAH MIZORI 2021 年 9 月 13 日
回答済み: Chunru 2021 年 9 月 13 日
I want to a matrix in txt for with the delimeter %%%

採用された回答

Chunru
Chunru 2021 年 9 月 13 日
x = magic(5);
fid = fopen('test.txt', 'w');
fprintf(fid, '%f\n', x); % try different format here
fclose(fid)
ans = 0
type('test.txt')
17.000000 23.000000 4.000000 10.000000 11.000000 24.000000 5.000000 6.000000 12.000000 18.000000 1.000000 7.000000 13.000000 19.000000 25.000000 8.000000 14.000000 20.000000 21.000000 2.000000 15.000000 16.000000 22.000000 3.000000 9.000000

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by