Questions about producing text file with data

2 visualizzazioni (ultimi 30 giorni)
g
g il 2 Dic 2018
Risposto: madhan ravi il 2 Dic 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!

Risposte (1)

madhan ravi
madhan ravi il 2 Dic 2018

Categorie

Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by