comparing the two column in MATLAB
42 次查看(过去 30 天)
显示 更早的评论
Hello!
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?
0 个评论
采纳的回答
madhan ravi
2018-11-22
编辑:madhan ravi
2018-11-22
rowswithidenticalvalues=find(A(:,1)==A(:,2)) %1 indicates the values are the same
5 个评论
Celestie Gladys
2023-1-26
@madhan ravi if i have to find the same colums in not just for 1st and 2nd colum but for the entire matrix ?
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!