Efficiently writing code to txt file

1 visualización (últimos 30 días)
Roy Veldhuizen
Roy Veldhuizen el 24 de Jul. de 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.

Respuestas (0)

Categorías

Más información sobre Text Data Preparation en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by