How can I implement a function from a FROM block with mulltiple input signals

1 次查看(过去 30 天)
implementing a function by itself works fine as shown in first picture.(bottom highlighted)
When I implement the same method from a FROM block with 3 signals i get an error.

回答(1 个)

Brahmadev
Brahmadev 2023-9-12
Hi Brian,
I understand that you are trying to input an array into the "MATLAB function" block and have encountered the error "Index Expression out of bounds". The probable cause of this error is the size of the input "u" from the "From" block. The input has dimensions 1x1.
If you would like to use a concatenation of "Signal1", "Signal2" and "Signal3" as the input to the "MATLAB Function block", connect them to a "Bus Creator" block and then send them to the "Goto" block.
Also, for troubleshooting issues related to dimension mismatch or “Out of bounds” errors, you can turn on “Signal Dimensions” in Debug->Information Overlays.
You can also refer to the MathWorks documentation for “Bus Creator” and “Goto” blocks below for more information.
  1. https://www.mathworks.com/help/simulink/slref/buscreator.html
  2. https://www.mathworks.com/help/simulink/slref/goto.html
Hope this helps!

类别

Help CenterFile Exchange 中查找有关 Sources 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by