Filter löschen
Filter löschen

Error in fprint command

1 Ansicht (letzte 30 Tage)
lilly lord
lilly lord am 13 Feb. 2021
Kommentiert: Star Strider am 13 Feb. 2021
Hi. here is part of my code. i am getting error in f print command. The code and error message is also attached. If any one can figure out the mistake. Thanks in advance
% fid = fopen('Result.txt', 'w');
fid = fopen(['Result/Result',int2str(k),',',int2str(l),',',int2str(m),',',int2str(n),',','.txt'], 'w');
for i=1:256
fprintf(fid,'%d',Trans(i,2)); %%% error is at this line(153)
fprintf(fid,',');
end
fclose(fid);
Error
Error using fprintf
Invalid file identifier. Use fopen to generate a valid file identifier.
Error in main_new (line 153)
fprintf(fid,'%d',Trans(i,2));

Akzeptierte Antwort

Star Strider
Star Strider am 13 Feb. 2021
The comma characters may not be permitted in the operating system you are using.
Replacing them with underscores ('_') may be the best option.
  2 Kommentare
lilly lord
lilly lord am 13 Feb. 2021
Thanks.
Star Strider
Star Strider am 13 Feb. 2021
As always, my pleasure!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Low-Level File I/O finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by