write values of different programm in next row of a text file
2 ビュー (過去 30 日間)
古いコメントを表示
Hello everyone,
I got a large programm for different experiments. Now I want to write the new result value in the same text file in the next row. Is this possible and how can I do that? Is there a function for that? I'm using Matlab R2020b for acadeic use.
I'm thankful for your ideas!
0 件のコメント
採用された回答
Smitesh Patil
2021 年 7 月 1 日
編集済み: Smitesh Patil
2021 年 7 月 1 日
Open the file in append mode
fileID = fopen('experiment_data.txt','a');
Then write the data using fprintf (assuming that data is just array of integers)
fprintf(fileID, "%d ", data);
then close the file
fclose(fileID);
その他の回答 (1 件)
KSSV
2021 年 7 月 1 日
Tou need to use '\n' in fprintf to write in the next line of the file. Read about fprintf.
fprintf('new line\n')
fprintf('Hello I am here')
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Low-Level File I/O についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!