Print Data to .txt Files
Afficher commentaires plus anciens
I have some problems on printing a whole data I have into a form of txt file. It consists of 5 variables and each variable is 3116x1 double. This is the script I made.
file_out2 = fopen(sprintf('%s%s%s', dir_in, name_file(8:11), '.txt'), 'w');
fprintf(file_out2, ' MJD_gab lat_gab SSH_gab SLA_gab YYF_gab\n');
fprintf(file_out2, '%14.8f %10.6f %10.4f %9.4f %16.8f\n', MJDgab, latgab, SSHgab, SLAgab, YYFgab);
fclose(file_out2);
In the first trial, the result came out but the variables were not printed into coloumn. It seems like they were printed 'horizontally'.

And everytime I ran the script for the second or manymore time, it always came error.
Perhaps it will work better if the script was corrected. I hope someone can help me out of this. Thank you for the help!
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Matrix Indexing 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!