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

4 views (last 30 days)
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

Accepted Answer

Varun Bhaskar
Varun Bhaskar on 11 Aug 2015
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 Comments
Thomas Becker
Thomas Becker on 12 Aug 2015
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!

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!