Effacer les filtres
Effacer les filtres

Questions about producing text file with data

1 vue (au cours des 30 derniers jours)
g
g le 2 Déc 2018
I have some data that contains two columns, and I want to print that data to a text file. This is my current scheme:
fileID = fopen('data.txt','w');
fprintf(fileID,'%f %f\n',data');
fclose(fileID);
However, I want to be able to add a string "label" to the end of the text file.
I tried the following, but it did not work:
fileID = fopen('data_%s.txt',label,'w');
fprintf(fileID,'%f %f\n',data');
fclose(fileID);
where label is a string variable that is defined earlier. How would I correctly do this so that it outputs data_thelabel.txt as my text file?
Additionally, one of the columns of data is just standard numbers, however, I want to the second column to be in scientific notation. How would I go about doing that for just the second column in the text file?
Thanks!

Réponses (1)

madhan ravi
madhan ravi le 2 Déc 2018

Catégories

En savoir plus sur Migrate GUIDE Apps 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