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.

3 Basic Program Components<br />

The purpose of this routine is to compute<br />

the value of ...<br />

%}<br />

Note With the exception of whitespace characters, the %{ and %} operators<br />

must appear alone on the lines that immediately precede and follow the block<br />

of help text. Do not include any other text on these lines.<br />

Semicolon — ;<br />

The semicolon can be used to construct arrays, suppress output from a<br />

<strong>MATLAB</strong> command, or to separate commands entered on the same line.<br />

Array Row Separator<br />

When used within square brackets to create a new array or concatenate<br />

existing arrays, the semicolon creates a new row in the array:<br />

A = [5, 8; 3, 4]<br />

A =<br />

5 8<br />

3 4<br />

Output Suppression<br />

When placed at the end of a command, the semicolon tells <strong>MATLAB</strong> not to<br />

display any output from that command. In this example, <strong>MATLAB</strong> does not<br />

display the resulting 100-by-100 matrix:<br />

A = ones(100, 100);<br />

Command or Statement Separator<br />

Like the comma operator, you can enter more than one <strong>MATLAB</strong> command on<br />

a line by separating each command with a semicolon. <strong>MATLAB</strong> suppresses<br />

output for those commands terminated with a semicolon, and displays the<br />

output for commands terminated with a comma.<br />

3-106

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

Saved successfully!

Ooh no, something went wrong!