Efficiently writing code to txt file
1 view (last 30 days)
Show older comments
Hello everybody,
I want to write code to a txt file, to import it in another program later. However, my data-matrix called Output is rather large (90941x12 units)
The code i'm using now is the following:
fid = fopen(fullfile('Darab Export','Output File 2.txt'), 'w+');
fprintf(fid,'%s\t',parts{1:end-1}); %# Write all but the last label
fprintf(fid,'%s\r\n',parts{end}); %write last label and new line
fclose(fid);
dlmwrite(fullfile('Darab Export','Output File 2.txt'), [Output],'delimiter','\t','newline', 'pc','precision','%.6f','-append') %write data
But it is working rather slow. Is this the most efficient way of writing data to a txt file, or are there faster methods?
Thanks in advance.
0 Comments
Answers (0)
See Also
Categories
Find more on Text Data Preparation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!