Question about Test for equality
1 回表示 (過去 30 日間)
古いコメントを表示
Hello guys!! So, i have this problem. I have two matrix of 125x3, with 1 and -1. When i do (A-B) then i will have one matrix of 125x3 full of zeros I need to know how many lines i have [0 0 0], so i need to count those lines and i will have a number ( obviously). I know how to use the length to get my number, but i'm having trouble testing the (A-B) matrix to find the lines with [0 0 0] Anyone has an advice for that?
Thanks a lot guys!!
0 件のコメント
採用された回答
Star Strider
2016 年 12 月 17 日
Try this:
A = [1 -1 1; 1 1 1; 0 1 0; 0 0 0; 1 0 -1; 0 0 0]; % Create Data
[Au,ia,ic] = unique(A, 'rows');
TallyRows = accumarray(ic, 1);
NumberOfZeroRows = TallyRows(1)
NumberOfZeroRows =
2
2 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Testing Frameworks についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!