mexPrintf (C and Fortran)
ANSI C PRINTF-style output routine
C Syntax
#include "mex.h" int mexPrintf(const char *message, ...);
Fortran Syntax
#include "fintrf.h" integer*4 mexPrintf(message) character*(*) message
Description
Note
The recommended way to call functions in C and C++ libraries is to create a MATLAB® interface to the library. For more information, see Call C/C++ from MATLAB. (since R2022a). Alternatively, to write MEX functions using C++ features and the MATLAB Data API for C++, see Write C++ Functions Callable from MATLAB (MEX Files).
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, which avoids linking the entire stdio library
into your MEX file.
In a C MEX file, call mexPrintf instead of
printf to display a string.
Note
If you want the literal % in your message, use
%% in the message string since % has
special meaning to printf. Failing to do so causes
unpredictable results.
Input Arguments
Output Arguments
Examples
To open an example, type:
edit([fullfile(matlabroot,"extern","examples","mex","filename")]);
where filename is:
To open an example, type:
edit([fullfile(matlabroot,"extern","examples","refbook","filename")]);
where filename is: