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

Asterisk — *<br />

An asterisk in a filename specification is used as a wildcard specifier, as<br />

described below.<br />

Filename Wildcard<br />

Wildcards are generally used in file operations that act on multiple files or<br />

directories. They usually appear in the string containing the file or directory<br />

specification. <strong>MATLAB</strong> matches all characters in the name exactly except for<br />

the wildcard character *, which can match any one or more characters.<br />

To locate all files with names that start with 'january_' and have a mat<br />

file extension, use<br />

dir('january_*.mat')<br />

You can also use wildcards with the who and whos functions. To get<br />

information on all variables with names starting with 'image' and ending<br />

with 'Offset', use<br />

whos image*Offset<br />

At — @<br />

The @ sign signifies either a function handle constructor or a directory that<br />

supports a <strong>MATLAB</strong> class.<br />

Function Handle Constructor<br />

The @ operator forms a handle to either the named function that follows the @<br />

sign, or to the anonymous function that follows the @ sign.<br />

Function Handles in General. Function handles are commonly used in<br />

passing functions as arguments to other functions. Construct a function<br />

handle by preceding the function name with an @ sign:<br />

fhandle = @myfun<br />

You can read more about function handles in “Function Handles” on page 4-23.<br />

3-98

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

Saved successfully!

Ooh no, something went wrong!