フィルターのクリア

label a matrix according to another label matrix

2 ビュー (過去 30 日間)
em
em 2014 年 11 月 11 日
回答済み: Azzi Abdelmalek 2014 年 11 月 11 日
I have a label matrix A
A=[1 1 1 1; 1 1 2 3; 3 2 1 4]
I have another boolean matrix B, each element labels each label in matrix A to be true or false
B=[0 0 1 1] % in A, label 1 and label 2 are false, label 3 and label 4 are true
How can I change matrix A according to B, result would look like:
A=[0 0 0 0; 0 0 0 1; 1 0 0 1]

回答 (2 件)

Sean de Wolski
Sean de Wolski 2014 年 11 月 11 日
>> C = ismember(A,find(B))
Enjoy!

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 11 月 11 日
A=[1 1 1 1; 1 1 2 3; 3 2 1 4]
B=[0 0 1 1]
C=ismember(A,find(B))

カテゴリ

Help Center および File ExchangeAxis Labels についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by