Level 2 Matlab S-function gives error while code generation
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am trying to use a Level 2 Matlab S-funtcion with the below code. There is no problem when I use it in normal mode but when I try to use it in external mode and build the code it says
"The corresponding 'CursOut.tlc' file for the MATLAB S-function 'CursOut' in block 'JustOut/Level-2 MATLAB S-Function' must be located in the current working directory, the MATLAB S-function directory 'C:\Users\generic\Desktop\RT\JustOut', or the directory 'C:\Users\generic\Desktop\RT\JustOut\tlc_c'"
My code is as below. Can anyone help? Thank you.
function CursOut(block)
setup(block);
function setup(block)
block.NumInputPorts = 0;
block.NumOutputPorts = 1;
block.SetPreCompOutPortInfoToDynamic;
block.OutputPort(1).Dimensions = 1;
block.OutputPort(1).DatatypeID = 0;
block.OutputPort(1).Complexity = 'Real';
block.OutputPort(1).SamplingMode = 'sample';
block.NumDialogPrms = 1;
block.RegBlockMethod('Outputs', @Outputs);
block.RegBlockMethod('Terminate', @Terminate);
function Outputs(block)
coords = get(0,'PointerLocation');
block.OutputPort(1).Data = coords(1);
function Terminate(block)
0 comentarios
Respuestas (1)
Kaustubha Govind
el 25 de Mzo. de 2014
Simulink cannot generate code from a MATLAB S-function unless you write a TLC file to inline it. See Inline MATLAB File S-Functions.
0 comentarios
Ver también
Categorías
Más información sobre Simulink Coder en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!