Compare each row of data with another vector data
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Ganesh Naik
am 22 Nov. 2022
Kommentiert: Ganesh Naik
am 25 Nov. 2022
Hi all, I have two vectors each of two columns, different row length.
A B


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.
0 Kommentare
Akzeptierte Antwort
Matt J
am 22 Nov. 2022
tmp=[discretize(A,[B(:,1);inf],'Inc','left'),...
discretize(A,[-inf;B(:,2)],'Inc','right')];
out=all(tmp==tmp(:,1),2);
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!