首页 > 其他 > 详细

MATLAB ' : ' 官方解释

时间:2016-08-13 16:51:07      阅读:246      评论:0      收藏:0      [点我收藏+]

1.冒号的作用

   产生矢量,阵列标注以及for-loop迭代子

2.描述

    冒号是MATLAB中最有用的操作符之一。它使用下述规则来创建有规则的空间矢量:

j:k

is the same as [j,j+1,...,k], or empty when j > k.

j:i: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 == 0i > 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:

A(:,j)

is the jth column of A.

A(i,:)

is the ith row of A.

A(:,:)

is the equivalent two-dimensional array. For matrices this is the same as A.

A(:,j:k)

is A(:,j), A(:,j+1),...,A(:,k).

A(:,:,k)

is the kth page of three-dimensional array A.

A(i,j,k,:)

is a vector in four-dimensional array A. The vector includes A(i,j,k,1)A(i,j,k,2)A(i,j,k,3), and so on.

A(:)

is all the elements of A, regarded as a single column. On the left side of an assignment statement,A(:) fills A, preserving its shape from before. In this case, the right side must contain the same number of elements as A.

注:上述内容来自于MATLAB帮助文档

MATLAB ' : ' 官方解释

原文:http://www.cnblogs.com/MICE1024/p/5768281.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!