Using find () in matlab

Say I have a matrix A dimension Nx3 , where N is the number of rows. A stores the x, y, z coordinates. Now let's say that I already have a set of known coordinates B = [x 'y' z '] that I want to look in A I want to know the number of row indices in A stores (x ', y', z '). How can i do this? I assume I will have to use find()

+4
source share
1 answer

you can use find e.g.

 find(A(:,1)==B(1) & A(:,2)==B(2) & A(:,3)==B(3)) 

will give the index of the string \ rows that matches.

Try using matlab reading, that's all ...

By the way, an alternative is to use ismember :

 [~,id]=ismember(B,A,'rows') 

the id variable will give the index of the rows where B matches A

+5
source

Source: https://habr.com/ru/post/1483728/


All Articles