Issue fprint outputting an xyz matrix to a file
11 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Wthee
le 1 Oct 2020
Réponse apportée : madhan ravi
le 1 Oct 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 commentaires
Réponse acceptée
madhan ravi
le 1 Oct 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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Data Import and Analysis dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!