write values of different programm in next row of a text file
1 次查看(过去 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!