Filter löschen
Filter löschen

Questions about producing text file with data

1 Ansicht (letzte 30 Tage)
g
g am 2 Dez. 2018
Beantwortet: madhan ravi am 2 Dez. 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!

Antworten (1)

madhan ravi
madhan ravi am 2 Dez. 2018

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by