increasing floating point for cellfun function

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.

 채택된 답변

Image Analyst
Image Analyst 2014년 6월 26일

0 개 추천

Why don't you just use %.8f instead of %s?????

댓글 수: 3

sermet
sermet 2014년 6월 26일
when you apply %.8f into form=[repmat('%s ',1,m) ' \r\n']. It gives irrelevant numbers into doc file.
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.
sermet
sermet 2014년 6월 26일
편집: sermet 2014년 6월 26일
The result is still same.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Cell Arrays에 대해 자세히 알아보기

질문:

2014년 6월 26일

편집:

2014년 6월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by