Path: news.mathworks.com!not-for-mail
From: "sathish kumar" <satty634@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: selection of combination under required conditions
Date: Wed, 2 Jan 2013 11:24:07 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 33
Message-ID: <kc15cn$bbq$1@newscl01ah.mathworks.com>
Reply-To: "sathish kumar" <satty634@gmail.com>
NNTP-Posting-Host: www-04-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1357125847 11642 172.30.248.35 (2 Jan 2013 11:24:07 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 2 Jan 2013 11:24:07 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 3581544
Xref: news.mathworks.com comp.soft-sys.matlab:785756

i want to find out combination that are satisfieng my conditions i.e
a1=12;   b1=5;  c1=5;
a2=13;   b2=6;   c2=2;
a3=14;   b3=7;   c3=8;
a4=15;   b4=8;   c4=9;
r=14;  h=7;
my condition is i want choose the combination that r>=a(i) and h>=b(i)  and  c should be max(i) i.e, if i found 3 combination say(  (a1,b1,c1)   (a2,b2,c2)   (a3,b3,c3) )
satisfies above conditions i.e, r>=a(i) and h>=b(i)  
and from these combination ,i want to choose the combination that has maximum 'c' value.
in example
a1=12;   b1=5;  c1=5;
a2=13;   b2=6;   c2=2;
a3=14;   b3=7;   c3=8;
 here first two combination satisfies our condition i.e,r>=a(i) and h>=b(i),but the value of c is not maximum of total combinations
here we have selected 3rd combination because it satisfies conditions i.e,r>=a(i) and h>=b(i) and as well as it has maximum C value

i have written code but it not giving the proper results
for i=1:length(set)
    if r >= a(i);
        if h >= b(i);
            if maxc == c(i);
                selected = i;
                break;
            end
        end
    end
end
choosen_set = dt{selected}

in this code i am getting the combination that satisfies r>=a(i) and h>=b(i), but not combination that has maximum c value from the found combinations  i.e i am gaetting the combination a2=13;   b2=6;   c2=2;  instead of combination a3=14;   b3=7;   c3=8;

please help me in this code ,i have tried but i am getting correct results
thanks in advance