How can I convert a uint12 data to an int12 data in Simulink?
15 ビュー (過去 30 日間)
古いコメントを表示
Thamira Joy Valentine
2020 年 3 月 23 日
コメント済み: Thamira Joy Valentine
2020 年 3 月 23 日
I have a 12 bit length 2's complement data that will need to be converted into int12 format in Simulink. The data conversion block in simulink only has output options of int8, int16, int32 or int64. Padding the 12 bit data will resultingly make the conversion inaccurate. Is there a way to convert this the uint12 to int12 in Simulink? Similarly I will have the same issue with converting a uint20 to int20 and uint24 to int24.
0 件のコメント
採用された回答
Fangjun Jiang
2020 年 3 月 23 日
If you have the fixed point toolbox, then it is straightforward. Define your data types and then use them anywhere in Simulink, treating them like the built-in types such as int8 or uint8.
>> MyInt12=fixdt(1,12,0);
>> MyUint12=fixdt(0,12,0)
MyUint12 =
NumericType with properties:
DataTypeMode: 'Fixed-point: binary point scaling'
Signedness: 'Unsigned'
WordLength: 12
FractionLength: 0
IsAlias: 0
DataScope: 'Auto'
HeaderFile: ''
Description: ''
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で String についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!