필터 지우기
필터 지우기

finding same values in the same place in different columns

조회 수: 1 (최근 30일)
Jos Huigen
Jos Huigen 2019년 6월 24일
답변: Vismay Raj 2019년 6월 24일
I have 2 columns, filled with scalars 0 or 1. I would like matlab to find all the 1's that are in the same place in one column as in the other, and the same thing for the 0's. How am I supposed to go about this? Any help would be greatly appreciated!
  댓글 수: 1
Bob Thompson
Bob Thompson 2019년 6월 24일
So, you want to find all rows that are 11, and 00? If so, I suggest using intersect.

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

채택된 답변

Vismay Raj
Vismay Raj 2019년 6월 24일
Not the right way but gets the job done, assuming the vectors are A and B
ANSWER = ((A+B) == 2) + ((A+B) == 0)
the brackets are really important , now in answer the 1s are corresponding to the indices where both A and B match

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by