Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: matrix manipulation-maximum value
Date: Sun, 24 Apr 2011 18:29:06 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 7
Message-ID: <ip1q5i$1ks$1@fred.mathworks.com>
References: <ip1o5p$28p$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-04-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1303669746 1692 172.30.248.35 (24 Apr 2011 18:29:06 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 24 Apr 2011 18:29:06 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:723580

"antonio ferreira" wrote in message <ip1o5p$28p$1@fred.mathworks.com>...
> Hi all. I have a very simple matrix A=[0 0.5;1 3;2 4;3 1; 4 0.5;5 7;6 8;7 9;8 10;9 3;10 13].
> As you can see the first column values are always growing. My objective is to compute the maximum value in the second column that corresponds to the range 3.5 to 7.2 in the first column. In this case matlab should only consider the sub matrix [4 0.5;5 7;6 8;7 9] and the final result should be 9. Is this possible to do in matlab?Many thanks.
- - - - - - - - -
max(A((3.5<=A(:,1))&(A(:,1)<=7.2),2))

Roger Stafford