Borrar filtros
Borrar filtros

Issue fprint outputting an xyz matrix to a file

1 visualización (últimos 30 días)
Wthee
Wthee el 1 de Oct. de 2020
Respondida: madhan ravi el 1 de Oct. de 2020
Attempting to convert a txt file that has three columns and many rows of xyz coords.
I'll just paste what I have.
file1 = fopen('test.txt' , 'w');
for m = 1:size(data,1)
fprintf( 'Create vertex x %.f y %.f z %.f\n',[data(m,1);data(m,2);data(m,3)]);
end
'data' is the file I am attempting to pull data from. No output to test.txt, at the moment.

Respuesta aceptada

madhan ravi
madhan ravi el 1 de Oct. de 2020
fid = fopen('test.txt' , 'w');
fprintf(fid, 'Create vertex x %.2f y %.2f z %.2f\n',data.')
fclose(fid)
Why not simply use writematrix() or writetable(), it's much easier.

Más respuestas (0)

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by