MATLAB ' : ' 官方解释
1.冒号的作用
产生矢量,阵列标注以及for-loop迭代子
2.描述
冒号是MATLAB中最有用的操作符之一。它使用下述规则来创建有规则的空间矢量:
is the same as [j,j+1,...,k], or empty when j > k. |
|
is the same as [j,j+i,j+2i, ...,j+m*i], where m = fix((k-j)/i), for integer values. For information on the definition of j:i:k with floating-point values, see Technical Solution 1-4FLI96. This syntax returns an empty matrix when i == 0, i > 0 and j > k, or i < 0 and j < k. |
如果你指定单标量阵列,MATLAB将j:i:k 解释为 j(1):i(1):k(1).
You can use the colon to create a vector of indices to select rows, columns, or elements of arrays, where: