Is it possible to pass and use hexadecimal values in simulink, without converting decimal?
50 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Dean DeBastiani
am 5 Jun. 2018
Kommentiert: Walter Roberson
am 1 Sep. 2020
I am trying to use hexadecimal values in a model, without converting to decimal. Does simulink have hexadecimal supported blocks?
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 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 Kommentare
Walter Roberson
am 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.
Weitere Antworten (1)
Andy Bartlett
am 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 Kommentare
Siehe auch
Kategorien
Mehr zu Simulink Functions finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!