Why does the table command change display format?

I set the display format to "short" because I want that 4 digits are shown after the decimal point, like 0.3124. I crate a "table" which should display the numbers as such. But the table shows 5 digits after the decimal point. Where am I going wrong?

 채택된 답변

Walter Roberson
Walter Roberson 2023년 4월 28일

1 개 추천

Where you are going wrong is in expecting table() objects to be designed to be display objects. They are not designed for display, they are designed for calculation.
table()'s disp() method has its own rules about what formats to use. It will display 4 decimal places if your current format setting is shorte

댓글 수: 4

Thanks for the explanation. How do I make the table show a fraction as 0.4123 then? So 4 digits after the decimal. When I set format to shortE, I get 4.1231e-01 which is not what I want.
create a second table that is round() of double() of the first table, set format longg and display the second table.
tables() are not designed as presentation objects. If you want a presentation object for a table, consider creating a uitable() in which you had applied round() to the numbers or in which you had pre-converted the numbers to text with the format you want. Or use the Report Generator.
Thanks a lot for all the elaboration.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

태그

질문:

2023년 4월 28일

댓글:

2023년 5월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by