- A file identifier obtained from fopen.
- 1 for standard output (the screen).
- 2 for standard error.
fprrintf MATLAB R2013a not working
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Yasmin Tamimi
el 29 de Sept. de 2014
Comentada: Stephen23
el 29 de Sept. de 2014
Hey everyone,
I'm sending my values to a txt file in MATLAB R2013a but the txt file remains empty and all the printing is done in the command window! Does anyone know why is this happening? And how can I print the values in a txt file?
fid = fopen('Code.txt','w');
fprintf('start a new cycle \n');
fprintf('t = %0.5f\t total_diss %0.5f\n', t, total_diss)
fclose(fid);
1 comentario
Stephen23
el 29 de Sept. de 2014
Syntax
fprintf(fileID,formatSpec,A1,...,An)
...
Input Arguments
fileID — File identifier1 (default) | 2 | scalar
File identifier, specified as one of the following:
Respuesta aceptada
Mischa Kim
el 29 de Sept. de 2014
Editada: Mischa Kim
el 29 de Sept. de 2014
Yasmine, use
fid = fopen('Code.txt','w');
fprintf(fid,'start a new cycle \n');
fprintf(fid,'t = %0.5f\t total_diss %0.5f\n', t, total_diss)
fclose(fid);
instead. Note that you need to add the fileID fid to the fprintf command.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Environment and Settings en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!