``````1:10
``````

MATLAB执行语句并返回一个包括整数的行向量，从`1``10` -

``````ans =

1    2    3    4    5    6    7    8    9   10
``````

``````100: -5: 50
``````

MATLAB执行语句并返回以下功效 -

``````ans =
100    95    90    85    80    75    70    65    60    55    50
``````

``````0:pi/8:pi
``````

MATLAB执行语句并返回以下功效 -

``````ans =
Columns 1 through 7
0    0.3927    0.7854    1.1781    1.5708    1.9635    2.3562
Columns 8 through 9
2.7489    3.1416
``````

`A(:,j)` `A`的第`j`
`A(i,:)` `A`的第`i`
`A(:,:)` 是等效的二维数组。对付矩阵，这与`A`沟通。
`A(j:k)` `A(j)`, `A(j+1)`,`...`,`A(k)`
`A(:,j:k)` `A(:,j)`, `A(:,j+1)`,`...`,`A(:,k)`
`A(:,:,k)` 是三维数组`A`的第`k`
`A(i,j,k,:)` 是四维数组`A`中的向量。向量包罗`A(i，j，k，1)``A(i，j，k，2)``A(i，j，k，3)`等。
`A(:)` `A`的所有要素，被视为单列。在赋值语句的左侧，`A(:)`填充`A`，从之前保存其形状。在这种环境下，右侧必需包括与`A`沟通数量的元素。

## 示例

``````A = [1 2 3 4; 4 5 6 7; 7 8 9 10]
A(:,2)      % second column of A
A(:,2:3)    % second and third column of A
A(2:3,2:3)  % second and third rows and second and third columns
``````

``````A =
1     2     3     4
4     5     6     7
7     8     9    10

ans =
2
5
8

ans =
2     3
5     6
8     9

ans =
5     6
8     9
``````

Matlab教程

2017-11-02