Issue fprint outputting an xyz matrix to a file
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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.
0 comentarios
Respuesta aceptada
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.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Text Files 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!