Effacer les filtres
Effacer les filtres

ssPrintf for C-Mex S-Function

12 vues (au cours des 30 derniers jours)
Sam
Sam le 18 Avr 2012
I would like to debug my S-Function using ssPrintf, but if the ssPrintf is between #ifndef MATLAB_MEX_FILE and #endif, there is no message printing out. Even I use mexPrintf or printf.
static void mdlOutputs(SimStruct *S, int_T tid)
{
ssPrintf("message1\n");
#ifndef MATLAB_MEX_FILE
ssPrintf("message2\n");
#endif
ssPrintf("message3\n");
}
-------------------------
Output in Command Windows:
message1
message3
-------------------------
Thanks!!!

Réponses (1)

Kaustubha Govind
Kaustubha Govind le 18 Avr 2012
When the S-function is compiled as a MEX-function, the symbol MATLAB_MEX_FILE is always defined, so that line is effectively getting eliminated by the C pre-processor. MATLAB_MEX_FILE is undefined only when generating code using Simulink Coder (formerly Real-Time Workshop), as a non-inlined S-function - ie, there is not TLC file associated with that S-function.

Catégories

En savoir plus sur Block and Blockset Authoring dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by