MATLAB Answers

simulink & Matlab-Fcn :undefined input argument error

2 views (last 30 days)
leila on 15 Jun 2012
I'm working on a Simulink model containing a MATLAB Fcn block. For example in a function like 'TEST' ,
function z = TEST(x,y)
u = round(x);
v = round(y);
z = u + v;
I have to define input variables of the block at the beginning of the function because this error is occurred:
??? Error due to multiple causes.
Caused by:
Input argument "y" is undefined.
Error evaluating MATLAB function in 'TEST/MATLAB Fcn'
But I can not define "y" because the "x" and "y" are supposed to be defined during the simulation…
How can I send input variables of the MATLAB Fcn block to the function that is written for it?
Thank you.

Answers (1)

Kaustubha Govind
Kaustubha Govind on 18 Jun 2012
Does the MATLAB Fcn block show up with two input ports on the Simulink model? I suspect that you may have unwittingly configured "y" as a parameter. To verify this, double-click on the block to open the Editor window, select Tools>Edit Data/Ports. Then select "y" on the left pane and ensure that "Scope" is set to "Input".

Community Treasure Hunt

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

Start Hunting!