Issue warning message
C Syntax
#include "mex.h"
void mexWarnMsgTxt(const char *warning_msg);
Arguments
warning_msg
String containing the warning message to be displayed.
Description
mexWarnMsgTxt
causes MATLAB to display the contents of error_msg
.
Unlike mexErrMsgTxt
, mexWarnMsgTxt
does not cause the MEX-file to terminate.
Examples
Consider a MEX-file that expects two input arguments. If the user enters no arguments, the MEX-file simply terminates. If the user enters one or more arguments, a warning is given but the MEX-file proceeds.
void
mexFunction(int nlhs,mxArray *plhs[],int nrhs,const mxArray
*prhs[])
{
if (nrhs == 0)
mexErrMsgTxt("You must pass 2 input args.");
else if (nrhs == 1) {
mexWarnMsgTxt("Expected 2 input args; you passed 1.");
mexWarnMsgTxt("Assuming that 'noplot' is the second arg.");
...
}
else if (nrhs == 2) {
...
}
else {
mexWarnMsgTxt("Ignoring all arguments past the second.");
...
}
For an additional example, see mexwarnmsgtxt.c
in the mex
subdirectory of the examples
directory.
See Also
mexErrMsgTxt
[ Previous | Help Desk | Next ]