I want to write data to a text file several times without overwriting the old values

10 views (last 30 days)
When the code runs, the data values are written on the text file. That's okey but i want to save data of code of previous running. While next running ,Can the new data be written after previous data i mean to the next line?? The code is :
for i=1:1:6;
X = [i; V; A; D; L];
fprintf(fileID,'\r\n%6s %6s %6s %6s %6s\r\n','i','V','A','D','L');
fprintf(fileID,'\r\n%6d %6d %6d %6d %6d\r\n',X);
end
fclose(fileID);

Accepted Answer

Cris LaPierre
Cris LaPierre on 10 Feb 2019
Sure. Use the append permission when opening the file with fopen.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!