reading signed hex values
8 ビュー (過去 30 日間)
古いコメントを表示
Hi all
I read hex values from an accelerometer : 35AC,2889,1899,0C4A,058B,FD46,F620,F001,EE44,EF08,EF46,F750,007F,0814,1369,21F3,34F0,45CE,5992,6D05,7C12,7FEF,7FF8,7FF8,7FF8,7FF8,7FD9,7F27,74A7,67D8,5826,468F,3621,2573,1326,0441,F88F,F1BF,F082,EADB,EAEE,EE04,F190,F89E,01F5,0B0C,155A,2721,3A20,48DC,5985,676A,721E,7C20,7FF8,7FEE,7F1B,
It should somehow draw a sinusoid curve, but I could not find the right import method for signed int16 and the curve jumps from 0 to 65535.
Could you please help me?
I have tried sscanf(...,'%4x')
could you please help me ?
regards
Julien

0 件のコメント
回答 (2 件)
Walter Roberson
2014 年 1 月 17 日
typecast(uint16(sscanf('F190', '%4x,')), 'int16')
Or:
t = sscanf('F190', '%4x,');
idx = t > 32767;
t(idx) = t(idx) - 65536;
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Encryption / Cryptography についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!