Compare each row of data with another vector data

3 views (last 30 days)
Hi all, I have two vectors each of two columns, different row length.
I would like to check each row of A with each/all of B (they have different row lengths) and would like to assign '1' for each row A if its value falls in any of row B's values. I could able to achieve the answer in case of one column. Any help in this regard highly appreciated. I have include the data here.

Accepted Answer

Matt J
Matt J on 22 Nov 2022
  1 Comment
Ganesh Naik
Ganesh Naik on 22 Nov 2022
Hi Matt, thanks for this version of the answer as well.

Sign in to comment.

More Answers (1)

Matt J
Matt J on 22 Nov 2022
out=any(A(:,1)>=B(:,1).' & A(:,2)<=B(:,2).',2);
Ganesh Naik
Ganesh Naik on 25 Nov 2022
Hi Matt thanks, I have accepted this answer now.

Sign in to comment.




Community Treasure Hunt

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

Start Hunting!

Translated by