我想控制m文件的切换。我想使用'if action'块来制作它,而'if action'块由Matlab函数控制。 Matlab函数的输入来自m文件。
Matlab函数的代码如下:
function y = fcn_test(x1, x2)
y = x1 + x2;
现在,我想从m文件传输Matlab函数的输入,例如x1和x2。 m文件如下:
clc
global x1
global x2
x1 = 1;
x2 = 2;
a = fcn_test(x1, x2);
disp(a)
错误为Simulink model 'fcn_test' was called with incorrect number of arguments
。那么代码的问题是什么?