大橙子网站建设,新征程启航

为企业提供网站建设、域名注册、服务器等服务

Matlab函数-创新互联

any() 相当于或操作,只要有1,就返回1Matlab函数

all() 相当于与操作,只要有0,就返回0

我们提供的服务有:成都网站设计、网站建设、微信公众号开发、网站优化、网站认证、前郭ssl等。为上千余家企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的前郭网站制作公司

C = union(A,B):

C为A和B的并集。去掉相同元素。

C = intersect(A,B)

C为A和B的交集. The values of C are in sorted order.

[Lia,Locb] = ismember(A,B):

判断A中元素是否为B中的子元素,如果不是则,Lia和Locb中元素值都为0(注意,Lia大小和A一样,Locb大小和B一样)。如果A中有元素是B中的,在Lia中对应返回值1,Locb, containing the highest index in B for each value in A that is a member of B. The output array, Locb, contains 0 wherever A is not a member of B.

[C,ia] = setdiff(A,B):

返回的C元素为在A中出现,但是没有在B中出现,ia为其索引值,满足C = A(ia)。

D = D(:)'; % ensure that D is a row vector

D(:)按列将矩阵变为列向量

reshape是根据原来的矩阵创造新的矩阵,repmat是将原来的矩阵复制多次,构成一个大矩阵。

>> A=magic(4)

A =

16 2 3 13

5 11 10 8

9 7 6 12

4 14 15 1

B = reshape(A,...,[],...) calculates the length of the dimension represented by the placeholder [], such that the product of the dimensions equals prod(size(A)). The value of prod(size(A)) must be evenly divisible by the product of the specified dimensions. You can use only one occurrence of [].

>> reshape(A,[],2)

ans =

16 3

5 10

9 6

4 15

2 13

11 8

7 12

14 1

max(a),若a为向量,返回大值,若a为矩阵,返回每列大值作为一个向量。

C = max(A,B) returns an array the same size as A and B with the largest elements taken from A or B. The dimensions of A and B must match, or they may be scalar.

C = max(A,[],dim) returnsthe largest elements along the dimension of A specifiedby scalar dim. For example, max(A,[],1) producesthe maximum values along the first dimension of A.

[C,I] = max(...) finds the indices of the maximum values of A, and returns them in output vector I. If there are several identical maximum values, the index of the first one found is returned.

K>> c=magic(4)

c =

16 2 3 13

5 11 10 8

9 7 6 12

4 14 15 1

K>> max(c) 等同于max(c,[],1)

ans =

16 14 15 13

K>> max(c,[],2)

ans =

16

11

12

15

K>> [m,n]=max(c,[],2)

m =

16

11

12

15

n =

1

2

4

3

find; sparse;full

[i,j,s] = find(S);
[m,n] = size(S);
S = sparse(i,j,s,m,n);

对于稀疏矩阵,i,j分别是不为零项的index,s是其值

So does this, if the last row and column have nonzero entries:

[i,j,s] = find(S);
S = sparse(i,j,s);


分享文章:Matlab函数-创新互联
文章转载:http://dzwzjz.com/article/dissje.html
在线咨询
服务热线
服务热线:028-86922220
TOP