フィルターのクリア

how i can find index of each element

1 回表示 (過去 30 日間)
Mohamuud hassan
Mohamuud hassan 2015 年 5 月 21 日
コメント済み: Andrei Bobrov 2015 年 5 月 21 日
hello all; i have one problem which
Ex_BWLasColum=[14;20;2;16;1;1;8;1;1;1;1;6;1;1;17;2;24;2;25;8;9;1;1;1;1;1;3;1;1;1;1;1;1;1;1;1];
Ex_BWFirscolm=[1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;2;2;2;3;6;8;8;9;14;16;17;20;24;25];
how i can find index of each element of Ex_BWFirscolm from Ex_BWLasColum.

採用された回答

Andrei Bobrov
Andrei Bobrov 2015 年 5 月 21 日
Only in your case:
[~,ii] = sort(Ex_BWLasColum);
  2 件のコメント
Thorsten
Thorsten 2015 年 5 月 21 日
i.e., in the case where Ex_BWLasColum contains no elements that are not contained in Ex_BWFirscolm.
Andrei Bobrov
Andrei Bobrov 2015 年 5 月 21 日
yes

サインインしてコメントする。

その他の回答 (1 件)

the cyclist
the cyclist 2015 年 5 月 21 日
編集済み: the cyclist 2015 年 5 月 21 日
[tf,loc] = ismember(Ex_BWFirscolm, Ex_BWLasColum);
(Or maybe switch the input arguments. I'm not sure which way you meant.)
tf is a boolean that indicates whether the element is present, and loc is an index that tells you the location. It sounds like you want loc.
  1 件のコメント
Mohamuud hassan
Mohamuud hassan 2015 年 5 月 21 日
編集済み: Mohamuud hassan 2015 年 5 月 21 日
thank you the cyclist; the output:
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
3
3
3
27
12
7
7
21
1
4
15
2
17
19
the first 22 elements was solved according to the element 1 of Ex_BWLasColum so, that was not my point.
my objective is to find first similar element of Ex_BWFirscolm according to similar number in the Ex_BWLasColum. then the second element of Ex_BWFirscolm according to the second similar number in the Ex_BWFirscolm. N.B:
the estimated result is: 5,6,8,9,10,11,........

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by