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.

Calling Functions<br />

Calling Functions<br />

This section describes the following topics on how to make function calls:<br />

• “What Happens When You Call a Function” on page 4-53<br />

• “Determining Which Function Is Called” on page 4-54<br />

• “<strong>MATLAB</strong> Calling Syntax” on page 4-57<br />

• “Passing Certain Argument Types” on page 4-61<br />

• “Passing Arguments in Structures or Cell Arrays” on page 4-63<br />

• “Assigning Output Arguments” on page 4-65<br />

• “Calling External Functions” on page 4-67<br />

• “Running External Programs” on page 4-68<br />

What Happens When You Call a Function<br />

When you call a function M-file from either the command line or from within<br />

another M-file, <strong>MATLAB</strong> parses the function into pseudocode and stores it<br />

in memory. This prevents <strong>MATLAB</strong> from having to reparse a function each<br />

time you call it during a session. The pseudocode remains in memory until<br />

you clear it using the clear function, or until you quit <strong>MATLAB</strong>.<br />

Clearing Functions from Memory<br />

You can use clear in any of the following ways to remove functions from the<br />

<strong>MATLAB</strong> workspace.<br />

Syntax<br />

clear functionname<br />

clear functions<br />

clear all<br />

Description<br />

Remove specified function from workspace.<br />

Remove all compiled M-functions.<br />

Remove all variables and functions.<br />

4-53

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

Saved successfully!

Ooh no, something went wrong!