日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

matlab中ismember_ismember matlab

發布時間:2025/4/16 128 豆豆
生活随笔 收集整理的這篇文章主要介紹了 matlab中ismember_ismember matlab 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

ismember 判斷A中的元素在B中有沒有出現

LIA = ismember(A,B) for arrays A and B returns an array of the same?size as A containing true where the elements of A are in B and false otherwise.

對于數組A合B,返回一個和A同樣尺寸的數組,若A某位置的元素在B中出現,則LIA相應位置為true,否則為false

LIA = ismember(A,B,'rows') for matrices A and B with the same number of columns, returns a vector containing true where the rows of A are also rows of B and false otherwise.

對于具有同樣列數的A和B,返回一個向量,行數和A相同,如果A的該行在B中出現,則LIA該行的值為1,如果A的該行在B中沒有出現過,返回0

[LIA,LOCB] = ismember(A,B) also returns an array LOCB containing the?highest absolute index in B for each element in A which is a member of ?B and 0 if there is no such index.

LOCB和數組A的大小一樣,里面包含A中元素在B中出現的位置,最大絕對值位置,即如果B中有兩個元素和A中某元素相同,那么就返回索引值最大的那個位置

[LIA,LOCB] = ismember(A,B,'rows') also returns a vector LOCB containing ?the highest absolute index in B for each row in A which is a member of B and 0 if there is no such index.

同上

In a future release, the behavior of ismember will change including:

-occurrence of indices in LOCB will switch from highest to lowest

-tighter restrictions on combinations of classes

In order to see what impact those changes will have on your code, use:

[LIA,LOCB] = ismember(A,B,'R2012a')

[LIA,LOCB] = ismember(A,B,'rows','R2012a')

If the changes in behavior adversely affect your code, you may preserve

the current behavior with:

[LIA,LOCB] = ismember(A,B,'legacy')

[LIA,LOCB] = ismember(A,B,'rows','legacy')

Examples:

a = [9 9 8 8 7 7 7 6 6 6 5 5 4 4 2 1 1 1]

b = [1 1 1 3 3 3 3 3 4 4 4 4 4 9 9 9]

[lia1,locb1] = ismember(a,b)

% returns

lia1 = [1 1 0 0 0 0 0 0 0 0 0 0 1 1 0 1 1 1]

locb1 = [16 16 0 0 0 0 0 0 0 0 0 0 13 13 0 3 3 3]

[lia2,locb2] = ismember(a,b,'R2012a')

% returns

lia2 = [1 1 0 0 0 0 0 0 0 0 0 0 1 1 0 1 1 1]

locb2 = [14 14 0 0 0 0 0 0 0 0 0 0 9 9 0 1 1 1]

[lia,locb] = ismember([1 NaN 2 3],[3 4 NaN 1])

% NaNs compare as not equal, so this returns

lia = [1 0 0 1], locb = [4 0 0 1]

Class support for inputs A and B, where A and B must be of the same

class unless stated otherwise:

- logical, char, all numeric classes (may combine with double arrays)

- cell arrays of strings (may combine with char arrays)

-- 'rows' option is not supported for cell arrays

- objects with methods SORT (SORTROWS for the 'rows' option), EQ and NE

-- including heterogeneous arrays derived from the same root class

《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀

總結

以上是生活随笔為你收集整理的matlab中ismember_ismember matlab的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。