| MATLAB Function Reference | ![]() |
Syntax
error('error_message')
Description
error(' displays an error message and returns control to the keyboard. The error message contains the input string error_message')
error_message.
The error command has no effect if error_message is a null string.
Examples
The error command provides an error return from M-files.
function foo(x,y)
if nargin ~= 2
error('Wrong number of input arguments')
end
The returned error message looks like:
» foo(pi) ??? Error using ==> foo Wrong number of input arguments
See Also
dbstop, disp, lasterr, warning, errordlg
| erf, erfc, erfcx, erfinv | errorbar | ![]() |