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.

Comma-Separated Lists<br />

Displaying Arrays<br />

Use a list to display all or part of a structure or cell array:<br />

A{:}<br />

ans =<br />

Hello<br />

ans =<br />

34<br />

ans =<br />

36<br />

ans =<br />

38<br />

.<br />

.<br />

.<br />

Concatenation<br />

Putting a comma-separated list inside square brackets extracts the specified<br />

elements from the list and concatenates them:<br />

A = [C{:, 5:6}]<br />

A =<br />

34 36 38 40 42 44 46 48<br />

whos A<br />

Name Size Bytes Class<br />

A 1x8 64 double array<br />

Function Call Arguments<br />

When writing the code for a function call, you enter the input arguments as a<br />

list with each argument separated by a comma. If you have these arguments<br />

stored in a structure or cell array, then you can generate all or part of the<br />

argument list from the structure or cell array instead. This can be especially<br />

useful when passing in variable numbers of arguments.<br />

This example passes several attribute-value arguments to the plot function:<br />

3-85

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

Saved successfully!

Ooh no, something went wrong!