Problem about proximity in matlab

Hi, all,
I defined an array like S=ones(N,x,'uint32'). And I give values to all of them. However I find out the maximum value is 65535 which is 2^16 not 2^32.
I tried 'uint64' but the limit is still 65535, why is that?
Thanks.

댓글 수: 4

How are you assigning the values?
>> S = ones(1,1,'uint32')
S =
1
>> S(1) = 99999
S =
99999
>> S(1)
ans =
99999
>> class(S)
ans =
uint32
C Zeng
C Zeng 2012년 10월 26일
Oh, it is weird here. Let me try again.
C Zeng
C Zeng 2012년 10월 26일
Oh, when I use class, it is converted to uint16. I need to figure out why?
However I only define uint32 at the beginning. So what could be a reason for converting to uint16? I am confused.
Image Analyst
Image Analyst 2012년 10월 27일
Calling class() causes no conversion. It must have got converted some other way.

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

답변 (1개)

Image Analyst
Image Analyst 2012년 10월 26일

0 개 추천

Somewhere along the way, you must have converted it to uint16, perhaps without realizing that you did so.

댓글 수: 4

C Zeng
C Zeng 2012년 10월 26일
편집: C Zeng 2012년 10월 26일
I use another value calculate from other function. But I did not convert it, traditionally if I do not convert what is the data type?
Walter Roberson
Walter Roberson 2012년 10월 26일
double
C Zeng
C Zeng 2012년 10월 26일
Thanks, Walter. I think it somewhere convert to double, however, double is more than uint32, right? Does it matter?
C Zeng
C Zeng 2012년 10월 26일
Now, I shut all programs off and restart it, seems that there is no such convert data type problems.

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

카테고리

도움말 센터File Exchange에서 Data Type Conversion에 대해 자세히 알아보기

태그

질문:

2012년 10월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by