change variable storage format

조회 수: 22 (최근 30일)
yonatan s
yonatan s 2018년 1월 11일
댓글: Stephen23 2018년 1월 11일
i have a matrix with have all sorts of values, like 1.062e+03 or 7.5646546.
i want to change the variable storage format to nonexponential and to 2 digits after decimal, for example 1062 and 7.56, because later on i'm displaying it in a uitable.
thank you
  댓글 수: 1
Stephen23
Stephen23 2018년 1월 11일
편집: Stephen23 2018년 1월 11일
"i want to change the variable storage format to nonexponential and to 2 digits after decimal, for example 1062 and 7.56"
This makes no sense. How numbers are stored in memory is totally irrelevant to how they are displayed in something like a uitable. If both of those numbers are class double then there is absolutely no distinction between how the values 1.062e+03 or 7.5646546 are stored in memory, and absolutely no way to change that storage (short of changing the value or storing it using a different class).
Do NOT confuse how numbers are stored in memory (esp. the class) with how a number is displayed (controlled by format, fprintf, the Variable Viewer, etc).

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

답변 (1개)

KSSV
KSSV 2018년 1월 11일
Read about fprintf
  댓글 수: 2
yonatan s
yonatan s 2018년 1월 11일
i dont want to print it, just to change the storage format
Stephen23
Stephen23 2018년 1월 11일
"just to change the storage format"
You can't. Numeric classes do NOT store any information on how values are displayed.

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

카테고리

Help CenterFile Exchange에서 Argument Definitions에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by