how can I FIND column of array part from another large array?

1 回表示 (過去 30 日間)
areej abdulshaheed
areej abdulshaheed 2019 年 11 月 21 日
コメント済み: areej abdulshaheed 2019 年 11 月 21 日
if I have two un equal matrix like A and B. How can I find the column of matrix A corrseponding to matrix B which have the same value?
for example if I have this array
B=[ 11 22 33 44 55 66 77 99 12 13 16 17 ]
A=[ 11 44 33 22 55 66 77 12]

採用された回答

Ruger28
Ruger28 2019 年 11 月 21 日
編集済み: Ruger28 2019 年 11 月 21 日
MATLAB has a function for this : ismember
doc ismember
B=[11 22 33 44 55 66 77 99 12 13 16 17];
A=[11 44 33 22 55 66 77 12];
[TrueFalse,IndexValues] = ismember(A,B); % is A inside of B
% TrueFalse is a logical representation of the values of A in B
% IndexValues is the indices of those values in B

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by