how to convert uint32(4294967278) to -16
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
areej abdulshaheed
am 29 Mai 2019
Beantwortet: areej abdulshaheed
am 29 Mai 2019
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)
1 Kommentar
Guillaume
am 29 Mai 2019
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.
Akzeptierte Antwort
Stephen23
am 29 Mai 2019
>> typecast(uint32(4294967278),'int32')
ans = -18
3 Kommentare
Steven Lord
am 29 Mai 2019
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.
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Data Type Conversion finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!