Matlab/Simulink S-Function: How to print to the command line
In Matlab/Simulink, you can print to the command line where Matlab was started using fprintf(stderr, ...)
. This is useful for debugging purposes.
At least in my setup, stdout is redirected, so printf
does not work as expected. However, fprintf(stderr, ...)
works fine.
fprintf(stderr, "Hello S-Function\n", blockPath);
This can be used anywhere in the S-function.
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow