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

58 次查看(过去 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 个评论
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 CenterFile Exchange 中查找有关 Simulink Functions 的更多信息

产品


版本

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by