Does Simulink offer any block that can tell me if the input is signed or unsigned ?
1 次查看(过去 30 天)
显示 更早的评论
Hello,
I am using Simulink/Embedded Coder and I was implementing a subsytem that needs to know if one of its inputs is signed or unsigned.
is there a block/function that can tell if an input is signed or unsinged? For example if the type of the input is Uint8, Uint16,Uint32 then the output of the block will be 0, and if the type is Int8, Int16, Int32 the block will be 1, let's say.
Thank you
Diaa
4 个评论
回答(1 个)
Benjamin Thompson
2022-1-31
There is a block in the Math Operations library called "Sign".
3 个评论
Benjamin Thompson
2022-1-31
The Signal Attributes library in Simulink has blocks similar to what you are asking for, such as data type inheritance, data type propagation. Or you could use a MATLAB Function block and use the "isa" functions to check on the type of the incoming inputs: isinteger, isnumeric.
isa(uint32(3), 'uint32')
ans =
logical
1
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Configure and View Diagnostics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!