Mux signals do not affect simulation or code generation. But when Code is generated using Mux Block then Arrays are getting generated. Please explain
6 views (last 30 days)
Show older comments
Eristoff Abhi
on 30 Jul 2021
Commented: Eristoff Abhi
on 6 Aug 2021
As per the Mathworks documentation https://in.mathworks.com/help/simulink/slref/mux.html?searchHighlight=Mux%20block&s_tid=srchtitle . Mux signals do not affect simulation or code generation. But when code is generated for the below logic, then the rightside code is generated as an Array. Please explain how come the block which is virtual can effect the Code Generation. Please let me know if i am missing something.
0 Comments
Accepted Answer
Andy Bartlett
on 2 Aug 2021
Edited: Andy Bartlett
on 2 Aug 2021
The mux block is not changing the values. In that sense, "Mux signals do not affect simulation or code generation."
But, as the documentation says, "The Mux block combines inputs with the same data type and complexity into a vector output."
If you never directly operate on that vector, the vector may not appear in the generated code. Your model is operating on the vector via the gain block, and the vector output from that gain block is written to a root level output port Out2. Keeping Out2 as a vector in the generated code is natural approach to handling all four values assigned to the port.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!