필터 지우기
필터 지우기

Force to display decimal places?

조회 수: 3 (최근 30일)
Jared
Jared 2011년 10월 17일
I'm using format short to set up my display preference. I store values in a matrix and then use uitable to display it.
Quick example of how it currently is displayed: 49.2250 150 123.2500e-04
How I want it: 49.2250e0 150.0000e0 123.2500e-04
Is it possible to force this in uitable?

채택된 답변

Sean de Wolski
Sean de Wolski 2011년 10월 17일
Sure, use sprintf.
doc sprintf
  댓글 수: 1
Walter Roberson
Walter Roberson 2011년 10월 17일
Additionally, note that uitable has no method of controlling the number of decimals for a field marked as being numeric, with the exception of declaring the field to use bank format. Sean's answer gets around this by storing strings in the uitable instead of numeric values. If you need the original numeric value back again, you will need to either retrieve it from the original data, or you will need to str2double() the string representation (which will give you an approximation of the original value.)

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by