Re: 多個矩陣存檔已回收
※ 引述《h6328140 (爽爽過)》之銘言:
: 若我要把多個矩陣存入同一個 .txt檔該如何寫比較好呢?
: 例如我現有兩組矩陣如下:
: 1 2 3
: 4 5 6
: 7 8 9
: --------
: 7 8 9
: 4 5 6
: 1 2 3
: --------
: 然後已有一組矩陣存入 .txt檔中
: 顯示如下:
: 1 2 3
: 4 5 6
: 7 8 9
: 之後我要在接在7 8 9以下存入
: 顯示如下:
: 1 2 3
: 4 5 6
: 7 8 9
: 7 8 9
: 4 5 6
: 1 2 3
: 這樣該如何做呢?謝謝!
我的程式是
讀第一個矩陣:
fod=fopen('D:\Triangular microstrip antenna\newsp\test3.txt','wt'); %存檔
for k=1:401
fprintf(fod,'%g %g %g\n',case1SP(k,:));
end
fclose(fod);
讀第二個矩陣:
fod=fopen('D:\Triangular microstrip antenna\newsp\test3.txt','a'); %存檔
for k=1:401
fprintf(fod,'%g %g %g\n',case2SP(k,:));
end
fclose(fod);
但以下這行用'a'
fod=fopen('D:\Triangular microstrip antenna\newsp\test3.txt','a');
他的格式就會變成
1 2 3
4 5 6
7 8 9
7 8 9 4 5 6 1 2 3
而在7 8 9 跟 4 5 6中間會有黑色長方形的圖案
不知是否有更好的寫法呢?謝謝!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 163.22.18.81
→
08/27 19:31, , 1F
08/27 19:31, 1F
→
08/27 19:35, , 2F
08/27 19:35, 2F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):