all() 相當于與操作,只要有0,就返回0
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中出現(xiàn),但是沒有在B中出現(xiàn),ia為其索引值,滿足C = A(ia)。
D = D(:)'; % ensure that D is a row vector
D(:)按列將矩陣變?yōu)榱邢蛄?/p>
reshape是根據(jù)原來的矩陣創(chuàng)造新的矩陣,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函數(shù)-創(chuàng)新互聯(lián)
瀏覽路徑:http://jinyejixie.com/article24/dissje.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供App設計、網(wǎng)站策劃、品牌網(wǎng)站設計、網(wǎng)站導航、建站公司、網(wǎng)站維護
聲明:本網(wǎng)站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經(jīng)允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內容