Code generation for Level 2 M-S Function

조회 수: 2 (최근 30일)
Vivek
Vivek 2014년 5월 22일
편집: Vivek 2014년 5월 22일
I am using a level 2 matlab s function in my model. When I try to generate code, got a error "tlc not found".
Don't know to write a tlc file, hence its an urgent requirement.
Can any one give me a c or tlc file which performs the inbuilt Simulink lookup table functionality.
Generally lookup table doesn't support for enumeration datatype. So only this function is created. If any one has this already, please give it to me.
My mask subsystem is
Here both of my inputs are enum type. My S fcn code is
function Test1(block)
%#eml
%model_call A Template for a Level-2 MATLAB S-Function
setup(block);
end
function Outputs(block)
xVal =double(block.InputPort(1).Data);
yVal =double(block.InputPort(2).Data);
xRow=double(block.DialogPrm(1).Data);
yCol=double(block.DialogPrm(2).Data);
zTbl=double(block.DialogPrm(3).Data);
LkMthd=block.DialogPrm(4).Data;
if yVal>yCol(end)
yVal=yCol(end);
elseif yVal<yCol(1)
yVal=yCol(1);
end
if xVal>xRow(end)
xVal=xRow(end);
elseif xVal<xRow(1)
xVal=xRow(1);
end
block.OutputPort(1).Data=interp2(xRow,yCol,zTbl,yVal,xVal,LkMthd);
end --the shown above is the only change from the Level 2 MS Function template.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Embedded Coder에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by