필터 지우기
필터 지우기

how to convert uint32(4294967278) to -16

조회 수: 9 (최근 30일)
areej abdulshaheed
areej abdulshaheed 2019년 5월 29일
답변: areej abdulshaheed 2019년 5월 29일
hi
how to convert the Y = typecast(uint32(X), 'uint32') to real no.
for example I want to calculate the present velocity for dynamixel servo motor. it is suppose to be -16
but each time I calculate it, I got this no. (4294967278)velocity.png
  댓글 수: 1
Guillaume
Guillaume 2019년 5월 29일
but each time I calculate it, I got this no. (4294967278)
Well, how do you "calculate" it? It sounds like you initially read a number as unsigned integer and now want a signed integer instead. Perhaps, the simple fix is to read the number properly as a signed integer avoiding the problem in the first place.

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

채택된 답변

Stephen23
Stephen23 2019년 5월 29일
>> typecast(uint32(4294967278),'int32')
ans = -18
  댓글 수: 3
areej abdulshaheed
areej abdulshaheed 2019년 5월 29일
how to convet it to real number
Steven Lord
Steven Lord 2019년 5월 29일
What do you mean by "real number"? Do you mean you want it in the double data type? If so call double on it. If you mean something else, please clarify.

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

추가 답변 (1개)

areej abdulshaheed
areej abdulshaheed 2019년 5월 29일
thank you again you helped me a lot
thank you sir

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by