i have Grid points and its coordinate x, y, z. I want to find out Grid point given x, y and z.

조회 수: 1 (최근 30일)
I have a set of Grid Points 1 thru N, and each has coordinated x, y and z.
Now I like to know how to get the Grid point number given x, y and z.

채택된 답변

KSSV
KSSV 2016년 10월 7일
Let A be your coordinates of size Nx2 and P be the point to seek the nodal number.
n = find(ismember(A,P,'rows'),1);
  댓글 수: 1
Pappu Murthy
Pappu Murthy 2016년 10월 7일
Thanks for this reply. I have one question. I did this problem the following way function[Vn] = VertexId(Gp,V) tempx = Gp(:,2:4)-repmat(V,length(Gp),1); tempx = sum(abs(tempx),2); tempx = tempx==0; [Vn]=find(tempx); In my array Gp (N,4)... the first column is Node number followed by x, y, z coordinates. V is x,y,z coordinates of querry node. I did 1000 times both ways and found that this way is 22 times faster than "ismember" approach this made me really curious and would like your comment on why so. Thanks again for very prompt reply and correct answer.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Biomedical Imaging에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by