increasing floating point for cellfun function
1 回表示 (過去 30 日間)
古いコメントを表示
cellArray1_1 =
[1] [38.583118749173565] [32.905715386802711] [36] '36S' [1.000000830761463]
[1] [38.583118749173565] [32.905715386802711] [36] '36S' [1.000000830761463]
Name Size Bytes Class Attributes
cellArray1_1 10x6 7180 cell global
c=cellfun(@num2str,cellArray1_1,'un',0)
[n,m]=size(c)
form=[repmat('%s ',1,m) ' \r\n']
for k=1:n
fprintf(fileID, form, c{k,:});
end
fclose(fileID);
%These codes writes cellArray1_1 into doc but number of digits to the right of the decimal point is 4, like 38.5831. I need to increase the floating point like 8.
0 件のコメント
採用された回答
Image Analyst
2014 年 6 月 26 日
Why don't you just use %.8f instead of %s?????
3 件のコメント
Image Analyst
2014 年 6 月 26 日
Well you have to do it right of course. Your 5th field is a string so you need four %.8f for the numbers, then a %s for the string, then another %.8f for the last number.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Environment and Settings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!