| MATLAB Application Program Interface Reference | Help Desk |
mexWarnMsgTxt
Issue warning message
#include "mex.h" void mexWarnMsgTxt(const char *warning_msg);warning_msg
String containing the warning message to be displayed.
mexWarnMsgTxt causes MATLAB to display the contents of error_msg.
Unlike mexErrMsgTxt, mexWarnMsgTxt does not cause the MEX-file to terminate.
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.
mexErrMsgTxt