| Products & Services | Industries | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
#include "mex.h" int mexPrintf(const char *message, ...);
integer*4 mexPrintf(message) character*(*) message
String to be displayed. In C, the string may include formatting conversion characters, such as those used with the ANSI C printf function.
In C, any additional arguments needed to translate formatting conversion characters used in message. Each conversion character in message is converted to one of these values.
Number of characters printed. This includes characters specified with backslash codes, such as \n and \b.
This routine prints a string on the screen and in the diary (if the diary is in use). It provides a callback to the standard C printf routine already linked inside MATLAB software, and avoids linking the entire stdio library into your MEX-file.
In a C MEX-file, you must call mexPrintf instead of printf to display a string.
Note If you want the literal % in your message, you must use %% in your message string since % has special meaning to mexPrintf. Failing to do so causes unpredictable results. |
See
mexfunction.c in the matlabroot/extern/examples/mex folder
phonebook.c in the matlabroot/extern/examples/refbook folder
mexErrMsgIdAndTxt, mexErrMsgTxt, mexWarnMsgIdAndTxt, mexWarnMsgTxt
![]() | mexMakeMemoryPersistent (C and Fortran) | mexPutVariable (C and Fortran) | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |