problem to arrange rows and columns with fprintf into world

1 回表示 (過去 30 日間)
sermet
sermet 2014 年 2 月 18 日
回答済み: kjetil87 2014 年 2 月 18 日
cellArray =
'p1' [4.1e+06] [2.78e+06] [3.94e+06]
'p2' [4.17e+06] [2.78e+06] [3.93e+06]
[ 3] [4.17e+06] [2.81e+06] [3.90e+06]
%class cell
%I want to write cellArray into world as it seen above.
v=cellArray
for k=1:size(v,1)
if ischar(v{k,1})
fprintf(fileID, '%3s %40f %3f \n', v{k,:});
else
fprintf(fileID, '%3d %40f %3f \n', v{k,:});
end
end
%It cannot arrange columns and rows as it seen above. (3*3 matrix) How can I write this cellArray in orderly.

採用された回答

kjetil87
kjetil87 2014 年 2 月 18 日
Your are missing one of the numbers/chars . v is 3x4 not 3x3.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCell Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by