After using the "find" function to get the position of a value in a matrix, how do I retreive the values in the corrosponding row?

댓글 수: 1

Rik
Rik 2022년 3월 25일
Did you read the documentation for find? What exact syntax are you using?

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

 채택된 답변

Mathieu NOE
Mathieu NOE 2022년 3월 25일

1 개 추천

hello
see example below :
use find with linear indices output (see the doc)
A = randn(5,3)
ind = find(A>0 & A<1)
B = A(ind)

댓글 수: 2

I interpreted the question a bit differently:
A = randn(5,3)
A = 5×3
-0.2579 -2.8261 -2.1941 0.6462 0.5321 0.3075 -0.1197 -0.2081 -0.5278 0.7857 0.4000 -0.8904 0.2132 0.4027 0.5705
[r,c]=find(A>0.7)
r = 4
c = 1
B = A(unique(r),:)
B = 1×3
0.7857 0.4000 -0.8904
Riley Heymann
Riley Heymann 2022년 3월 27일
편집: Riley Heymann 2022년 3월 27일
yes this is it, thank you Rik

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

질문:

2022년 3월 25일

편집:

2022년 3월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by