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 />

Dynamic Structure Fields<br />

Sometimes it is useful to reference structures with field names that can<br />

vary. For example, the referenced field might be passed as an argument to a<br />

function. Dynamic field names specify a variable name for a structure field.<br />

The variable fundtype shown here is a dynamic field name:<br />

type = funds(5,2).(fundtype);<br />

See “Using Dynamic Field Names” on page 2-81 for more information.<br />

Exclamation Point — !<br />

The exclamation point precedes operating system commands that you want to<br />

execute from within <strong>MATLAB</strong>.<br />

Shell Escape<br />

The exclamation point initiates a shell escape function. Such a function is to<br />

be performed directly by the operating system:<br />

!rmdir oldtests<br />

See “Shell Escape Functions” on page 3-29 for more information.<br />

Parentheses — ( )<br />

Parentheses are used mostly for indexing into elements of an array or for<br />

specifying arguments passed to a called function.<br />

Array Indexing<br />

When parentheses appear to the right of a variable name, they are indices<br />

into the array stored in that variable:<br />

A(2, 7, 4)<br />

3-104

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

Saved successfully!

Ooh no, something went wrong!