save variables in a file
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I need to save in a .txt file some of the variables calculated. Each variables should occupy one column separated by tab. What is the most appropriate way of doing it?
with the line:
save('q20.txt','p','D','de','A','L','W','Per','RFF','En','D','Lm','Wm','Aratio','N2D','N3D','a','Df2D','Df3D','-ascii', '-tabs')
I save the variables in one file. But the variables are listed one below the other .
Thanks
0 commentaires
Réponse acceptée
Walter Roberson
le 9 Mai 2011
fid = fopen('q20.txt','wt');
fprintf(fid, [repmat('%g\t',1,17),'%g\n'], [p(:), D(:), de(:), A(:), L(:), W(:), Per(:), RFF(:), En(:), D(:), Lm(:), Wm(:), Aratio(:), N2D(:), N3D(:), a(:), Df2D(:), Df3D(:)].' );
fclose(fid);
Note: the dot-apostrophe after the close-square-bracket is required for proper output
0 commentaires
Plus de réponses (1)
Voir également
Catégories
En savoir plus sur File Operations 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!