Effacer les filtres
Effacer les filtres

error using fopen

2 vues (au cours des 30 derniers jours)
kash
kash le 2 Mai 2012
i have some values in loop ,when writing it to a text pad i get as
6.000000[]7.000000[]
i need only as 6 and 7
fprintf(fileID,'%1f\n',num)
please help

Réponses (1)

Richard
Richard le 2 Mai 2012
what about:
a = [6,7];
filename = 'E:\test.txt';
fid = fopen(filename,'wt');
fprintf(fid,'%g\t%g',a);
fclose(fid)
By using %g this will leave no trailing zeros.

Catégories

En savoir plus sur Data Import and Export dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by