how to count the match

2 ビュー (過去 30 日間)
Engg
Engg 2012 年 7 月 21 日
if suppose I am matching some value with another values in loop and want to calculate no of matched and unmatched sequences .What code should I add for count?

回答 (2 件)

per isakson
per isakson 2012 年 7 月 21 日
I guess that if you are not more specific you'll get an answer like this :)
number_of_matches = 0;
...
if is_match
number_of_matches = number_of_matches + 1;
end

Eristoff Abhi
Eristoff Abhi 2012 年 7 月 21 日
As i am assuming that you are comparing two strings or two set of string: for eg: a={'count'} b={'count1', 'count2', 'count3','library','class','link'} now u can do x=strmatch(a,b); mat=length(x); unmat=length(b)-mat;
I hope this answer your doubt.

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by