23.06.2015 Views

MATLAB Programming

MATLAB Programming

MATLAB Programming

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

5 Types of Functions<br />

unless you declare them as global within the pertinent functions, or pass<br />

them as arguments.<br />

Calling Subfunctions<br />

When you call a function from within an M-file, <strong>MATLAB</strong> first checks the file<br />

to see if the function is a subfunction. It then checks for a private function<br />

(described in the following section) with that name, and then for a standard<br />

M-file or built-in function on your search path. Because it checks for a<br />

subfunction first, you can override existing M-files using subfunctions with<br />

thesamename.<br />

Accessing Help for a Subfunction<br />

You can write help for subfunctions using the same rules that apply to primary<br />

functions. To display the help for a subfunction, precede the subfunction<br />

name with the name of the M-file that contains the subfunction (minus file<br />

extension) and a > character.<br />

For example, to get help on subfunction mysubfun in file myfun.m, type<br />

help myfun>mysubfun<br />

5-34

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

Saved successfully!

Ooh no, something went wrong!