Is it possible to pass and use hexadecimal values in simulink, without converting decimal?
58 views (last 30 days)
Show older comments
Dean DeBastiani
on 5 Jun 2018
Commented: Walter Roberson
on 1 Sep 2020
I am trying to use hexadecimal values in a model, without converting to decimal. Does simulink have hexadecimal supported blocks?
0 Comments
Accepted Answer
Walter Roberson
on 5 Jun 2018
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 Comments
Walter Roberson
on 1 Sep 2020
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.
More Answers (1)
Andy Bartlett
on 1 Sep 2020
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
0 Comments
See Also
Categories
Find more on Simulink Functions 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!