Reputation: 77
I have a long string with a lot of information, some empty rows and combined numbers and text in it. I tried to save it into txt file but it writes me a txt file with strange/unreadable characters:
Here is my code which does not work:
name_log = TPR_E01;
filename = strcat('New_',name_log);
save ( filename,'newCleanMarker')
Thank you!
Upvotes: 1
Views: 2166
Reputation: 114786
save
writes binary data by default. You can try the '-ascii'
flag, or better still you can print the string to file
fid = fopen( ['New_', name_log], 'w' ); %// open file to writing
fprintf( fid, '%s', newCleanMarker ); %// print string to file
fclose( fid ); %// don't forget to close the file
Please see the following man pages
fopen
- how to open a file in Matlab.fullfile
- a good practice to create file names and paths.save
- saving binary data, and the use of '-ascii'
flag.Upvotes: 2