mexPrintf no longer works in r2014a?

mexPrintf() seems to have stopped working entirely in r2014a?
I have several fully-inlined C MEX S functions, which need to open up work vectors for signal buffers. To keep an eye on them, I have code in the .c file which ways something like:
mexPrintf("Initialised a buffer of %d samples.\n", *MaxDelaySamples+1);
I always used to see a stream of these messages pop up in my command window when running a model, or when creating new RTW code from the model code.
Under r2014a, however, the messages don't appear at all? I didn't change anything in my code which should affect this, so far as I am aware. Any ideas?

3 comentarios

Andrew Roscoe
Andrew Roscoe el 12 de Ag. de 2014
Thinking about it, I don't think I am seeing any information from real-time workshop builds in my command window any more on the computer with R2014a on it. I don't see the rows of .'s "..............." as anything builds. Is there some setting in r2014a that disables MEX output to the command window? MEX is definitely working by the way, compiling code. Just no visibility of it in the command window.
Andrew Roscoe
Andrew Roscoe el 12 de Ag. de 2014
Something called a diagnostic viewer has popped up and I can see all the MEX outputs in there. But, this only comes up when there is an error. I can't find anything in documentation which describes how to bring up the Diagnostic viewer BEFORE you have an error, if you just want to observe MEX outputs ...?
Michael Gipser
Michael Gipser el 27 de Ag. de 2014
Editada: Michael Gipser el 27 de Ag. de 2014
same here. Both in 2014a and 2014b (on Mac OS X 10.9.4), I get mexPrintf output only incomplete. More precise: I use it in a level 2 S-function. mexPrintf output within mdlInitializeSizes, mdlInitializeSampleTimes, mdlInitializeConditions, mdlStart gets completely lost (both in command window and diary). Strange enough, output from all other mdl routines (mdlOutput, mdlUpdate, mdlTerminate) does appear. For certain compatibility reasons, I have to link my S-functions against Matlab libs version 2009b, but test it in 2014a/b environment.
In Matlab 2009b, complete output is there. Just testet 2013b. Fine as well.

Iniciar sesión para comentar.

 Respuesta aceptada

Kaustubha Govind
Kaustubha Govind el 27 de Ag. de 2014

0 votos

In general ssPrintf is recommended over mexPrintf in S-functions, although in normal simulation that runs via the MEX-file, this should just expand to mexPrintf.
You can open the Diagnostic Viewer even when there are no errors via the menu on the Simulink Editor Window: View>Diagnostic Viewer. Alternately, you can run the model using the command-line interface with the SIM command to have the output stream redirected to the MATLAB command window.

4 comentarios

Michael Gipser
Michael Gipser el 29 de Ag. de 2014
Editada: Michael Gipser el 29 de Ag. de 2014
Kaustubha, thanks for your reply. Actually, I didn't mention this: same behavior with ssPrintf. And same behavior with C and Fortran.
Your advice: all these are nothing but workarounds. What about making mexPrintf/ssPrintf behave as designed and documented?
Michael
Kaustubha Govind
Kaustubha Govind el 29 de Ag. de 2014
Michael: Could you please contact MathWorks Tech Support and submit an enhancement request so that the relevant development team can consider not redirecting the output stream to the Diagnostic Viewer? Tech Support may also be able to provide a solution if there is one better than what I suggested.
Michael Gipser
Michael Gipser el 29 de Ag. de 2014
ok, I will submit a request. Thanks, Michael.
Andrew Roscoe
Andrew Roscoe el 11 de Sept. de 2014
I noticed something else now. Using either mexPrintf or ssPrintf: If you run your model from the "Run" arrow in Simulink, the output comes out in the diagnostic viewer. BUT, if you have a MATLAB script which calls your model, the output does NOT come out in the diagnostic viewer. It comes out back in the "proper" place in the MATLAB command window where you expect it!

Iniciar sesión para comentar.

Más respuestas (2)

Andreas Viborg
Andreas Viborg el 3 de Feb. de 2017

0 votos

This is really a strange behaviour, I was using the ssprint with the newline character \n in 2016b. As the printout didn't show up in the command prompt i googled and found this thread which led me to the solution to check the diagnostic Viewer, and there it was! Strange thing though is that when I skip the newline the output goes to the matlab command window. It also seems like the output goes differently depending on if the call is from the start function or the output function.
Jan
Jan el 5 de Jun. de 2018
Editada: Jan el 5 de Jun. de 2018

0 votos

Happens with my code as well. If I skip the \n character I can see it in the command window. However, with the \n it is redirected to the diagnostic Viewer. I am using 2016b as well. I am glad I found this thread, at least my Output is somewhere :)

Categorías

Más información sobre Configure and View Diagnostics en Centro de ayuda y File Exchange.

Productos

Etiquetas

Preguntada:

el 12 de Ag. de 2014

Editada:

Jan
el 5 de Jun. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by