Why does the "-ASCII" option flag with the SAVE function add extra end-of-line characters in MATLAB?
Show older comments
Why does the "-ASCII" option flag with the SAVE function add extra end-of-line characters in MATLAB?
When I create or load data into MATLAB and then write it out to a file using the SAVE function with the -ascii option flag, it adds extra characters to the end of each row of data. This behavior did not happen in versions of MATLAB previous to MATLAB 6.1 (R12.1).
The code below replicates this behavior:
% First create some data
h = rand(15,2);
% Now save h in ASCII format to a .dat file
save newoutput.dat h -ascii
Now open newoutput.dat in Notepad. You will notice that at the end of each row of data, an extra character has been appended. This extra control character has the appearance of having been generated in UNIX.
Note, however, that the output looks correct if you open it within Wordpad.
Accepted Answer
More Answers (0)
Categories
Find more on Entering Commands in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!