23.06.2015 Views

MATLAB Programming

MATLAB Programming

MATLAB Programming

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

8 Error Handling<br />

warnings by issuing control statements. These statements place the specified<br />

warning(s) into a desired state and have the format<br />

warning state msg_id<br />

Control statements can also return informationonthestateofselected<br />

warnings. This only happens if you assign the output to a variable, as shown<br />

below. See “Output from Control Statements” on page 8-19.<br />

s = warning('state', 'msg_id');<br />

Warning States<br />

There are three possible values for the state argument of a warning control<br />

statement.<br />

State<br />

on<br />

off<br />

query<br />

Description<br />

Enable the display of selected warning message.<br />

Disable the display of selected warning message.<br />

Display the current state of selected warning.<br />

Message Identifiers<br />

In addition to the message identifiers already discussed, there are two other<br />

identifiers that you can use in control statements only.<br />

Identifier<br />

msg_id string<br />

all<br />

last<br />

Description<br />

Set selected warning to the specified state.<br />

Set all warnings to the specified state.<br />

Set only the last displayed warning to the specified<br />

state.<br />

Note <strong>MATLAB</strong> starts up with all warnings enabled, except for those that are<br />

displayed in response to the command, warning('query', 'all').<br />

8-18

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!