function [sys,x0,str,ts] = controller(t,x,u,flag) switch flag case 0 [sys,x0,str,ts]=mdlInitializeSizes; case 1 sys=mdlDerivatives(t,x,u); case 2 sys=mdlUpdate(t,x,u); case 3 sys=mdlOutputs(t,x,u); case 4 sys=mdlGetTimeOfNextVarHit(t,x,u); case 9 sys=mdlTerminate(...
代码尝试将B赋值给A的第二列,此时等号右侧B有4个元素,等号左侧A的第二列有3个元素,个数不相等引起报错。为了正常运行,等号右侧也应该是3个元素,例如: B = [11 12 13]; A(2,:) = B 更详细的说明请参考: https://www.mathworks.com/help/matlab/math/array-indexing.html 源链接:www.mathworks...
function [sys,x0,str,ts] = controller(t,x,u,flag) switch flag case 0 [sys,x0,str,ts]=mdlInitializeSizes; case 1 sys=mdlDerivatives(t,x,u); case 2 sys=mdlUpdate(t,x,u); case 3 sys=mdlOutputs(t,x,u); case 4 sys=mdlGetTimeOfNextVarHit(t,x,u); case 9 sys=mdlTerminate(...