当前位置:网站首页>[matlab] Simulink the input and output variables of the same module cannot have the same name

[matlab] Simulink the input and output variables of the same module cannot have the same name

2022-07-06 18:46:00 Cheap meow

For a simple example :
 Insert picture description here

Can run through :

Test1

function y = fcn(u)

y = ones(3,4);

Test2

function y = fcn(u)

y = ones(4,3)*u;

Will report a mistake :

Test1

function y = fcn(u)

y = ones(3,4);

Test2

function u = fcn(u)

u = ones(4,3)*u;

The fault of this times is Test2 Medium u Dimension mismatch
But it's strange , It's reasonable to say this u It should be directly covered , The original dimension should not be considered
Therefore, the input and output variables of the same module cannot have the same name , Probably Simulink The module in is so retarded

Of course, the result of the same name is more than that , This problem comes from my friend , He set the input and output with the same name , There is no error in that module , But the output will go wrong , I don't know how to engrave it again for a moment ……

原网站

版权声明
本文为[Cheap meow]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/187/202207061039296739.html