MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1
Displaying Arrays

Use a list to display all or part of a structure or cell array:

A{:}

ans =

Hello

ans =

[2] [10] [18] [26] [34] [42]
[4] [12] [20] [28] [36] [44]
[6] [14] [22] [30] [38] [46]
[8] [16] [24] [32] [40] [48]

ans =

16 2 3 13
5 11 10 8
9 7 6 12
4 14 15 1

Concatenation

Putting a comma-separated list inside square brackets extracts the specified elements
from the list and concatenates them:

A = [C{:,5:6}]

A =

34 36 38 40 42 44 46 48

Function Call Arguments

When writing the code for a function call, you enter the input arguments as a list with
each argument separated by a comma. If you have these arguments stored in a structure
or cell array, then you can generate all or part of the argument list from the structure or
cell array instead. This can be especially useful when passing in variable numbers of
arguments.

2 Program Components

Free download pdf