Sir, I want to read fffd to '-3' not '65533'
6 views (last 30 days)
Show older comments
I think I need to use a typecast. but I don't know how to use it.. I find inverse answer about my question.
sprintf('%x', typecast(int16(-3),'uint16'))
ans =
fffd
but I want to change fffd to -3 please help me sir..
0 Comments
Answers (1)
Image Analyst
on 23 Nov 2015
Try this:
theString = sprintf('%x', typecast(int16(-3),'uint16'))
negNumber = double(hex2dec(theString)) - double(intmax('uint16')) - 1;
fprintf('%s is %d in signed 16 bit integer\n', theString, negNumber);
0 Comments
See Also
Categories
Find more on String Parsing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!