Level 2 Matlab S-function gives error while code generation
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Kaustubha Govind
le 25 Mar 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 commentaires
Voir également
Catégories
En savoir plus sur Simulink Coder dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!