how can i open and add text to a .txt file?
16 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
ben velt
am 3 Jun. 2015
Kommentiert: ben velt
am 3 Jun. 2015
Hello,
I have this List.txt file:
id firstname_lastname department first second third
3033011 Penelope_Cruz Cnm 99 88 77
404402 Gary_Cooper Bio 45 45 45
5055022 Tony_Curtis Dis 23 89 100
606603 Jim_Carrey Mng 100 100 100
I need to open it with matlab and then I need to add this:
12131415 Jack_Nicholson Mat 60 70 80
to List.txt
How can I do this?
also, I can only get the name Jack Nicholson without the underscore.
Thanks
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 3 Jun. 2015
fid = fopen(filename, 'at');
if fid ~= -1
fprintf(fid, ...... whatever.....
fclose(fid);
end
6 Kommentare
Image Analyst
am 3 Jun. 2015
Then do
fprintf(fid, '%d %s %s %d %d %d\n', id, name, department, first, second, third);
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Low-Level File I/O finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!