problem using fprintf for writing celldata into world.

2 ビュー (過去 30 日間)
sermet
sermet 2014 年 2 月 17 日
回答済み: Walter Roberson 2014 年 2 月 17 日
v =
[ 1] [ 0.005414061590159] [-0.089918561343438]
'p2' [-0.055125605058493] [ 0.077283840482778]
'p3' [ 0.041872392912978] [ 0.048029359618340]
%class is cell
%I perform to write v into ms word like that,
for k=1:size(v,1)
fprintf(fileID, '%3s %40f %3f \n', v{k,:});
end
%It cannot write "1" into world. (others appears) How can I write v with full of first column?

採用された回答

Walter Roberson
Walter Roberson 2014 年 2 月 17 日
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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by