Compare each row of data with another vector data
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi all, I have two vectors each of two columns, different row length.
A B
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1202448/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1202453/image.png)
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
채택된 답변
Matt J
2022년 11월 22일
tmp=[discretize(A,[B(:,1);inf],'Inc','left'),...
discretize(A,[-inf;B(:,2)],'Inc','right')];
out=all(tmp==tmp(:,1),2);
추가 답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!