Decimal to Hexadecimal conversion in simulink/stateflow

11 次查看(过去 30 天)
Hi,
Is it possible to convert a decimal to hexadecimal without using dec2hex() command.I mean,using just simulink blocks or inside a stateflow chart?

回答(2 个)

Walter Roberson
Walter Roberson 2011-11-10
You can use arithmetic blocks with division and mod() and subtractions and the like. But you will have to decide exactly what data type you want your output to be, as I do not recall that characters are one of the supported signal types.
  2 个评论
Meenu
Meenu 2011-11-10
Yeah, i tried using division and mod,but was unable to chart out a logic for the decimal-hexadecimal conversion.So,u mean it might not be possible to get the output as hexadecimal itself?
When we type dec2hex(15) on the command window,it displays F.
so i thought it would be possible to read it as hex.
Kaustubha Govind
Kaustubha Govind 2011-11-10
Meenu: If you execute "class(dec2hex(15))" at the MATLAB prompt you'll see that dec2hex produces the "char" type, which is not a valid Simulink datatype. Could you explain how you plan to use the hex value in Simulink?

请先登录,再进行评论。


Pranav
Pranav 2011-11-10
type in command window: >> edit dec2hex.m
The function logic can be seen.. You can use the same logic to build simulink models.

类别

Help CenterFile Exchange 中查找有关 Signal Operations 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by