compare two matrices to get index matrix

i need a code for comparing two matrix
which have the same length(a) = length(b)
a = [01 05 09 06 07 08 04 10 12 05]
b = [02 05 07 04 10 05 10 13 06 05]
to extract 3 index matrix for 3 cases
if (a >b) result: x = [3 4 6 9]
(a <b) y = [1 5 7 8]
(a =b) z = [2 10]

回答 (1 件)

Walter Roberson
Walter Roberson 2019 年 7 月 4 日

0 投票

find(a>b)
find(a<b)
find(a==b)

カテゴリ

ヘルプ センター および File ExchangeMatrix Indexing についてさらに検索

質問済み:

2019 年 7 月 4 日

回答済み:

2019 年 7 月 4 日

Community Treasure Hunt

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

Start Hunting!

Translated by