extracting the index of an irregular line on a 2D matrix

조회 수: 5 (최근 30일)
hamed
hamed 2020년 11월 27일
댓글: KSSV 2020년 11월 27일
Hi.
I have a 2D matrix and a vector which passes through some samples of this matrix irregularly. The vector values ​​shows the Y values ​​of the samples it passes through. I want to extract the index of each sample of this vector roughly. In other words, I want to know the corresponding index number of each vector sample, in the matrix. Please find attached the image. The vector values ​​are shown in white line passes throgh the 2D matrix (image).
Any suggestions?
Thanks.

답변 (1개)

KSSV
KSSV 2020년 11월 27일
Read about ismember.
A = rand(10) ;
B = A(randperm(100,10)) ;
[c,ia] = ismember(A(:),B) ;
A(c)
  댓글 수: 7
KSSV
KSSV 2020년 11월 27일
Then how you expect to extract? For every given t, we will get a complete column of x.

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

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by