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

1 vue (au cours des 30 derniers jours)
Brian Kiprono
Brian Kiprono le 3 Déc 2022
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.

Réponses (1)

Brahmadev
Brahmadev le 12 Sep 2023
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!

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by