if else
古いコメントを表示
i need to compare s=[0 1] with I=[0 0;1 1;1 0;0 1;1 0;0 0; 1 0; 1 1; 0 0;.............................90bits] i want to use counter .can any one help me
採用された回答
その他の回答 (1 件)
Sean de Wolski
2011 年 6 月 24 日
idx = ismember(I,s,'rows'); %row indices of matches
nmatches = sum(idx); %number of matches
row_indices = find(idx); %row numbers of matches
A few of the things you can do...
3 件のコメント
mahaveer hanuman
2011 年 6 月 24 日
Sean de Wolski
2011 年 6 月 24 日
Why? nmatches will be the same result as a counted (like in Paulo's below example)
I guess this must be homework...
Paulo Silva
2011 年 6 月 24 日
I was almost commenting the same you did :) your code is the best way to do it unless it's really homework.
カテゴリ
ヘルプ センター および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!