Code generation for Level 2 M-S Function
1 次查看(过去 30 天)
显示 更早的评论
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/163221/image.png)
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 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Target Language Compiler 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!