フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Put cells with rowise strings togehter

2 ビュー (過去 30 日間)
Marc Gebhardt
Marc Gebhardt 2017 年 10 月 20 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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

回答 (2 件)

Guillaume
Guillaume 2017 年 10 月 20 日
fprintf(fid, strjoin(yourcellarray, '\n'))

Jan
Jan 2017 年 10 月 20 日
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'.

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by