write to file in exponential notation
Afficher commentaires plus anciens
Iam writing a variable r to file using the following code
r= [0.000452403093670532 0.000445718222208873];
str='test.txt';
str1=['r =',mat2str(r)];
dlmwrite(str,str1,'-append', 'delimiter', '', 'precision','%-6.6e','newline', 'pc');
but no matter how I try always write it in decimal notation. I want to write it in exponential notation somenthing like
r= [4.524e-4 4.457e-4];
any help will be grately appreciated!!
Réponses (3)
Matt Fig
le 2 Avr 2011
0 votes
Try FPRINTF instead of DLMWRITE.
1 commentaire
Maider Marin
le 3 Avr 2011
bym
le 2 Avr 2011
how about
strl = sprintf('r = %5.4e %5.4e ',r)
1 commentaire
Maider Marin
le 3 Avr 2011
Maider Marin
le 3 Avr 2011
Catégories
En savoir plus sur Text Files dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!