Which lines between two vectors are not equal?
2 次查看(过去 30 天)
显示 更早的评论
Hi everyone,
I am looking at two vectors, and I want matlab to tell me at which lines they two vectors are not equal. I will attach two sample columns of 0's and 1's. For example, the csv file I've uploaded is NOT equal at (4:7,:) and (14:15,:). How can I have matlab return that information to me?
Thanks in advance!
0 个评论
采纳的回答
Walter Roberson
2018-3-6
data(:,1) ~= data(:,2)
??
2 个评论
Walter Roberson
2018-3-7
If you want the row numbers displayed with the rows:
idx = find(data(:,1) ~= data(:,2));
[idx(:), data(idx,:)]
If you just want the contents of the rows:
data(data(:,1) ~= data(:,2), :)
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!