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!
Walter Roberson
Walter Roberson 2015년 8월 12일
from_workspace and pass it through a type conversion block, possibly?

댓글을 달려면 로그인하십시오.

추가 답변 (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