필터 지우기
필터 지우기

How can I display an integer with a number of digits in uitable?

조회 수: 3 (최근 30일)
Le Huy
Le Huy 2015년 9월 11일
댓글: Walter Roberson 2015년 9월 12일
Hi everyone!
Particularly, I have:
A=[1 6 8; 0.2554 1.6641 1.123]
Is it possible to display it in uitable as :
1.0000 6.0000 8.0000 ; 0.2554 1.6641 1.1230.
Thank you all too much!

채택된 답변

Walter Roberson
Walter Roberson 2015년 9월 11일
Set the ColumnFormat to {'short', 'short', 'short'}
  댓글 수: 3
Le Huy
Le Huy 2015년 9월 12일
Hi Walter! I tried the way you recommended! Unfortunately, It doesn't work! Is there any other way to solve this problem that you know? I have looked for the ways in the documentation that the Matlab supports but I have not found out yet.
Walter Roberson
Walter Roberson 2015년 9월 12일
Darn, it treats the outputs differently than I expected.
You will need to output as strings.
Astr = reshape(cellstr(num2str(A(:),'%.4f')),size(A));
Then set the Data property of the uitable to Astr.
If you allow the user to edit the table and then you read in the values remember that they will be strings so use str2double() to convert them to numbers.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Dialog Boxes에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by