MATLAB Function Interface Error

4 views (last 30 days)
Jon
Jon on 9 Nov 2011
Commented: Shubham Kapoor on 15 Apr 2015
I have a MATLAB function block that has two inputs and one output. One input is a column vector with values for calculations and is a variable size. The other input is a bus signal with a fixed size. The output is another column vector that is a variable size. I have checked all the ports (both in the model explorer and the ports and data manager, which I think should show the same thing as far as the ports go) on the input blocks, the function block, and the output block. From what I can tell they all are set to the proper mode (i.e. variable or fixed) but I am still getting the following error:
MATLAB Function Interface Error: Unable to propagate the variable-size mode from the input 'SimulinkReactor' of 'SimulinkReactor'. This input expects a fixed-size mode. The variable-size mode originates from 'SimulinkMATLAB Function Block/MATLAB Function Block/ SFunction '. Examine the configurations of 'MATLAB Function Block' for one of the following scenarios: 1. The block does not support variable-size signals 2. The block supports variable-size signals but needs to be configured for them. You can enable variable-sizing for 'MATLAB Function Block' from the ports and data manager dialog.
Any ideas what I could be missing?

Answers (2)

Kaustubha Govind
Kaustubha Govind on 9 Nov 2011
It looks like the error is about the output of the MATLAB Function block. Have you configured it as a variable-size signal and specified the maximum dimensions correctly? See this page for an example. It looks like you also need to use the coder.varsize directive to specify that the output is of variable-size.
  7 Comments
Jon
Jon on 18 Nov 2011
Yes, I have checked the "Variable Size" check box. You were right. It is the block I am sending the signal to. I need to send the signal to an integrator block. Is there a block that will convert the signal?
Kaustubha Govind
Kaustubha Govind on 21 Nov 2011
There is no way to convert a variable-size signal to a fixed-size signal, because that doesn't make sense - how would you convert a signal that varies size during simulation to one that doesn't? Perhaps you should rewrite your MATLAB Function block code to emit fixed-size signals if that's what makes sense for your application. You can always use the maximum size at all times, and fill in the invalid elements with zero (or some invalid value) if you really want to simulate a variable-size signal.

Sign in to comment.


imran Hossain
imran Hossain on 5 Feb 2012
i have same problem with the interface error in simulink block. i create the 16-apsk modulation and demodulation block using matlab code. when i run this individual block there is no error but when i put this block other existing 16-qam or psk it shows "MATLAB Function Interface Error: Simulation stopped due to out of bounds error. Block MATLAB Function1 (#19) While executing: none ". anybody if have some idea or logic, i would like to request please share with necessary information.
  1 Comment
Shubham Kapoor
Shubham Kapoor on 15 Apr 2015
did u sort the problem out?I have to write the apsk modulation code and demodulation code too.Can you help in writing the code for modulation and demodualtion

Sign in to comment.

Categories

Find more on Test Model Components in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!