Number of decimal places for Matrix Entry

I want to increase the number of decimal places a figure can accurately be shown in an entry of a Matrix, using fprintf it shows all entries up to 4dp but how can I increase the d.p?
Thanks
Joe

댓글 수: 2

post an example
Joe
Joe 2014년 1월 17일
Say A is the matrix fprintf('%10.7f',X) I understand 10 to be the spacing -character width and 7 related to the dp but the matrix i get is only to 4d.p.

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

 채택된 답변

Walter Roberson
Walter Roberson 2014년 1월 16일

0 개 추천

What is a "Matrix" for this purpose?
What format are you using with fprintf() ?
fprintf('%.999g\n', pi)

댓글 수: 2

Joe
Joe 2014년 1월 17일
Say A is the matrix fprintf('%10.7f',X) I understand 10 to be the spacing -character width and 7 related to the dp but the matrix i get is only to 4d.p.
>> fprintf('%10.7f\n', pi)
3.1415927
Is what you are doing like
A = fprintf('%10.7f', pi);
If it is then what is being stored in A is the number of elements output, not the string. If you want the string use sprintf
A = sprintf('%10.7f', pi);

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

추가 답변 (0개)

카테고리

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

태그

질문:

Joe
2014년 1월 16일

댓글:

2014년 1월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by