フィルターのクリア

fprintf a long cell array vector into the file

1 回表示 (過去 30 日間)
Akbar
Akbar 2018 年 6 月 6 日
コメント済み: Akbar 2018 年 6 月 6 日
I have 1x43 cell Array where each cell contains string (variable name), size can vary but it's always a vector. So in this case there are 43 variables. When I print it into the file I get two extremely Long lines. How can I print this cell in such a way that ist readable without Scrolling all over the horizontal axis? For ex. Would be good if I could print it in five rows instead of two. And at the end of each row there should be this "..." (continuation sign). This is how I am printing myLongCellArray:
fmt=['variablesList' repmat('%s,',1,length(myLongCellArray)-1) '%s)\n'];
fprintf(fid,fmt,myLongCellArray{:});

採用された回答

Stephen23
Stephen23 2018 年 6 月 6 日
編集済み: Stephen23 2018 年 6 月 6 日
One very simple solution is to put each name on its own line:
fprintf(fid,'variablesList: ');
fprintf(fid,'%s,...\n',myLongCellArray{1:end-1});
fprintf(fid,'%s\n',myLongCellArray{end});
  1 件のコメント
Akbar
Akbar 2018 年 6 月 6 日
Thank you, Stephen!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeText Data Preparation についてさらに検索

タグ

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by