Simulink Mux block does not accept integer value for "number of inputs"

2 次查看(过去 30 天)
Hello,
I would like to know, why the Mux block's parameter "Number of inputs" does only accept values of type double, whereas single or uint8 result in an error. Examples:
* 5 - ok
* double(5) - ok
* single(5) - error
* uint8(5) - error
Is there any explanation for that behaviour or is it just a bug?
Thanks in advance! Thomas

采纳的回答

Varun Bhaskar
Varun Bhaskar 2015-8-11
Hello Thomas,
Can you describe why you are trying to perform single(5), double(5) and uint(5)? We are interested in knowing about the workflow.
  2 个评论
Thomas Becker
Thomas Becker 2015-8-12
Hello Varun,
thanks for your answer. First of all I already got an answer from your MathWorks support colleagues:
"This is intended behavior. To this day we have not seen a use case where having something other than double might be useful. Thus only doubles which are the base Simulink type are accepted as valid inputs. This is done to simplify the implementation of the block and limit the number of potential errors. "
However, if only doubles are supported due to easier implementation - I understand that. But technically it still seems to be wrong to me. The number of signals in a mux block is definitely an integer value, not a double; so I would expect a value of integer data type to be valid.
To answer your question: I'm not really trying to use uint8(5) directly in a mux block, but I have a workspace variable with data type uint8, let's say
NumberOfCylinders = uint8(4)
As it's physically not a double for simulation and code generation purposes, I'm using uint8 instead of double. Consistently, I would like to use the same variable in a mux block.
If it means much work on your side, you can close this issue and I live with a workaround. But on the other hand it will always be hard to explain to your customers, why integers are not supported ;-)
Thanks again and enjoy the day!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simulink Functions 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by