马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
function [sys,x0,str,ts] = getfile(t,x,u,flag)
switch flag
case 0
[sys,x0,str,ts]=mdlInitializeSizes;
case 3
sys=mdlOutputs(t,x,u);
case {1,2,4,9}
sys=[];
otherwise
error(['Unhandled flag = ',num2str(flag)]);
end
function [sys,x0,str,ts]=mdlInitializeSizes
sizes = simsizes;
sizes.NumContStates = 0;
sizes.NumDiscStates = 0;
sizes.NumOutputs = 1;
sizes.NumInputs = 0;
sizes.DirFeedthrough = 1;
sizes.NumSampleTimes = 1; % at least one sample time is needed
sys = simsizes(sizes);
x0 = [];
str = [];
ts = [-1 0];
function sys=mdlOutputs(t,x,u)
%a=1;
%b=2;
%filename=('C:\Program Files\MATLAB\R2006b\work\simulink\102_7.tif');
%I=imread(filename);
%M=double(I);
a=[1 2 3];
b=[4 5 6];
I=a+b;
sys =I; 提示错误是:Output returned by S-function 'getfile' in 'sumwe/S-Function' during flag=3 call must be a real vector of length 1.请高手指点一下,不胜感激! |