Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Put cells with rowise strings togehter

1 visualización (últimos 30 días)
Marc Gebhardt
Marc Gebhardt el 20 de Oct. de 2017
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
Hey guys, i have a cell with for example 10 rows and 1 column. In every field, a string is inserted like "1,amps,25,1". For writing this in a txt file, i now use a for loop with the fprintf command. So every line is added with a single operation. This takes too much time. Is it possible to arrange all cellstrings as one string with line break and then only write ones in a file?
Thanks Marc

Respuestas (2)

Guillaume
Guillaume el 20 de Oct. de 2017
fprintf(fid, strjoin(yourcellarray, '\n'))

Jan
Jan el 20 de Oct. de 2017
fprintf(fid, '%s\n', YourCell{:});
I don't think that this is much faster. Try to open the file with the 'W' flag instead of the lower case4 'w'.

La pregunta está cerrada.

Community Treasure Hunt

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

Start Hunting!

Translated by