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

2 ビュー (過去 30 日間)
Thomas Becker
Thomas Becker 2015 年 8 月 6 日
コメント済み: Walter Roberson 2015 年 8 月 12 日
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 Center および File ExchangeSimulink Functions についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by