Level 2 Matlab S-function gives error while code generation
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Kaustubha Govind
am 25 Mär. 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 Kommentare
Siehe auch
Kategorien
Mehr zu Simulink Coder finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!