how to specify additional parameters(vector or matrix) using level2 matlab s-function

here's the level1 s-function,tTime and yStep are both vector parameters:
function [sys,x0,str,ts]= mdlInitializeSizes
if true
sizes = simsizes;
sizes.NumContStates = 0;
sizes.NumDiscStates = 0;
sizes.NumOutputs = 1;
sizes.NumInputs = 0;
sizes.DirFeedthrough = 0;
sizes.NumSampleTimes = 1;
sys = simsizes(sizes);
x0 = [];
str =[];
ts = [0 0];
function sys =mdlOutputs(t,tTime,yStep)
i=find(tTime<=t); sys=yStep(i(end));
the problem is that i don't know how write the level2 output function:
function Outputs(block)
if true
i=find(tTime<=t);
block.OutputPort(1).Data = yStep(i(end));
end
the tTime and yStep are vectors specified by user,such as tTime=[0.1 0.2 0.3 0.4]; yStep=[-1 1 0 2];

답변 (0개)

카테고리

도움말 센터File Exchange에서 Block and Blockset Authoring에 대해 자세히 알아보기

제품

질문:

2014년 9월 18일

편집:

2014년 9월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by