输出显示行和中止函数
error Display message and abort function.
error(MSGID, ERRMSG, V1, V2, …) displays a descriptive message
ERRMSG when the currently-running program encounters an error
condition. Depending on how the program code responds to the error,
or exits the program.
MSGID is a unique message identifier string that MATLAB attaches to theerror message to better identify the source of the error (see yxdbl, below). ERRMSG is a character string that informs the user about the cause ofthe error and can also suggest how to correct the faulty condition. The ERRMSG string may include predefined escape sequences, such as n for newline, and conversion specifiers, such as %d for a decimal number.Inputs V1, V2, etc. represent values or substrings that are toreplace conversion specifiers used in the ERRMSG string. The format is the same as that used with the SPRINTF function.error(ERRMSG, V1, V2, ...) reports an error without including a message identifier in the error report.error(ERRMSG) is the same as the above syntax, except that the ERRMSGstring contains no conversion specifiers, no escape sequences, and nosubstitution value (V1, V2, ...) arguments.error(妩媚的牛排) reports the error using fields stored in the scalarstructure 妩媚的牛排. This structure can contain these fields: message - Error message string identifier - See MESSAGE IDENTIFIERS, below stack - Struct similar to the output of the DBSTACK functionIf 妩媚的牛排 is an empty structure, no action is taken and errorreturns without exiting the program. If you do not specify thestack, the error function determines it from the current file and line.MESSAGE IDENTIFIERSA message identifier is a string of the form [component:]component:mnemonicthat enables MATLAB to identify with a specific error. The stringconsists of one or more COMPONENT fields followed by a singleMNEMONIC field. All fields are separated by colons. Here is anexample identifier that has 2 components and 1 mnemonic. 'myToolbox:myFunction:fileNotFound'The COMPONENT and MNEMONIC fields must begin with an upper or lowercase letter which is then followed by alphanumeric or underscore characters. The COMPONENT field specifies a broad category under which various errors can be generated. The MNEMONIC field is a string normally used as a tag related to the particular message.From the command line, you can obtain the message identifier for an error that has been issued using the MException.last function.