Azzera filtri
Azzera filtri

Efficiently writing code to txt file

2 visualizzazioni (ultimi 30 giorni)
Roy Veldhuizen
Roy Veldhuizen il 24 Lug 2012
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.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by