Is it possible to pass and use hexadecimal values in simulink, without converting decimal?

45 ビュー (過去 30 日間)
I am trying to use hexadecimal values in a model, without converting to decimal. Does simulink have hexadecimal supported blocks?

採用された回答

Walter Roberson
Walter Roberson 2018 年 6 月 5 日
No. Hexadecimal is encoded as characters, and character is not a supported Simulink signal type.
You are permitted to pass around vectors of uint8 such as uint8('3e') = uint8([51 101]) and then char() the vector within a MATLAB Function Block or Level 2 S Function that wants the char version.
  2 件のコメント
Dean DeBastiani
Dean DeBastiani 2018 年 6 月 5 日
Thank you very much for your help, this is very useful.
Walter Roberson
Walter Roberson 2020 年 9 月 1 日
Andy Bartlett's Answer reminds me that in R2019b, Simulink was enhanced to permit character vectors as a data type.
I cannot think of any special Simulink blocks that work with hex, though.

サインインしてコメントする。

その他の回答 (1 件)

Andy Bartlett
Andy Bartlett 2020 年 9 月 1 日
If you are interested in entering parameters in hex or binary
For MATLAB integer types,
then as of R2019b, MATLAB has newly added the ability
to enter literals in hex and binary format.
myParam1 = 0x2A
myParam2 = 0b11111110
For fixed-point fi objects,
values can be entered in hex or binary like, so
myParam3 = fi([],0,8,3,'hex','AC')
myParam4 = fi([],0,8,3,'bin','01101001')
% To check the hex and binary
myParam3.hex
myParam4.bin
If you are interested in viewing the hex or binary representation of signals,
please see

カテゴリ

Help Center および File ExchangeString についてさらに検索

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by