I am having two matrix. Selected elements in one matrix is present as elements in another matrix. Now i need to find the position of selected elements in the original matrix.
for example
yenidendonguyegirecekler =
-1321.6
-2119.8
-2825.5
-2937.5
-3205.4
-3340.9
-3895.0
-4080.2
-4320.9
fitnesshafiza =
-4080.2
-2937.5
-2825.5
-5749.6
-3205.4
-2119.8
-3340.9
-4320.9
-3895.0
-1321.6

 채택된 답변

Voss
Voss 2022년 5월 14일

1 개 추천

yenidendonguyegirecekler = [
-1321.6
-2119.8
-2825.5
-2937.5
-3205.4
-3340.9
-3895.0
-4080.2
-4320.9];
fitnesshafiza = [
-4080.2
-2937.5
-2825.5
-5749.6
-3205.4
-2119.8
-3340.9
-4320.9
-3895.0
-1321.6];
To find where the elements of yenidendonguyegirecekler are located in fitnesshafiza:
[~,idx] = ismember(yenidendonguyegirecekler,fitnesshafiza)
idx = 9×1
10 6 3 2 5 7 9 1 8

댓글 수: 2

Metehan Geçer
Metehan Geçer 2022년 5월 14일
thx a lot <3
Voss
Voss 2022년 5월 14일
You're welcome!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

the cyclist
the cyclist 2022년 5월 14일

0 개 추천

You can use the ismember function to find out whether each element of one vector is present in the other, and also the location.

카테고리

도움말 센터 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품

릴리스

R2021a

태그

질문:

2022년 5월 14일

댓글:

2022년 5월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by