MATLAB Answers

comparing the two column in MATLAB

97 views (last 30 days)
Sky Scrapper
Sky Scrapper on 22 Nov 2018
Commented: madhan ravi on 22 Nov 2018
Let, A=[ 1 2 ; 2 2; 3 4; 4 4]
I want to compare the 1st column with the 2nd column to find out if there is any row having the same values in both columns.
Say, in the example, 2nd and 4th rows have the same values in both the two columns. i need to find the rows where the condition is satisfied.
Could you please help me?

Accepted Answer

madhan ravi
madhan ravi on 22 Nov 2018
Edited: madhan ravi on 22 Nov 2018
rowswithidenticalvalues=find(A(:,1)==A(:,2)) %1 indicates the values are the same

Sign in to comment.

More Answers (0)


Community Treasure Hunt

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

Start Hunting!

Translated by