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

2 Ansichten (letzte 30 Tage)
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

Akzeptierte Antwort

Varun Bhaskar
Varun Bhaskar am 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 Kommentare
Thomas Becker
Thomas Becker am 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!
Walter Roberson
Walter Roberson am 12 Aug. 2015
from_workspace and pass it through a type conversion block, possibly?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Simulink Functions finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by