simulink & Matlab-Fcn :undefined input argument error

1 次查看(过去 30 天)
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.

回答(1 个)

Kaustubha Govind
Kaustubha Govind 2012-6-18
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".

类别

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

产品

Community Treasure Hunt

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

Start Hunting!

Translated by