How can i change the default size of a variable
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi all
when i enter a variable in command window... it is showing the size of a variable is 8 bytes....
is thereany ways to change the size of the variable???
Thanks
댓글 수: 0
답변 (3개)
Image Analyst
2012년 2월 13일
What size do you want? You can cast it if you want, for example
intK8 = uint8(doubleK);
intK16 = uint16(doubleK);
singleK = single(doubleK);
댓글 수: 0
Walter Roberson
2012년 2월 13일
The only way to change the default size of variables is to go back to MATLAB 2.x before MATLAB supported double precision.
댓글 수: 0
Jan
2012년 2월 13일
The "size" of a variable, which is defined as a scalar is "[1 x 1]", this means "one scalar value". The "8 bytes" is the memory required to store a double value. Defining a int64 occupies 8 bytes also, while a single needs 4 bytes. A double can store a value more accurately than a single, an in consequence it requires mire bytes to be stored.
Why do you want to change the "precision" (not "size") of a variable?
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Performance and Memory에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!