Thread Subject: Range in Matlab

Subject: Range in Matlab

From: deluded.soul@gmail.com

Date: 19 Jan, 2008 23:12:58

Message: 1 of 5

Hi everyone,

I need to find the min and max value in a subset of an array

normally, if I have a 2D array called x, I can do

min(min(x)) and this works fine...

However, if this array is 128 X 128, I just want the minimum between
the indexes [5, 5,] and [123, 123]... How can I specify this?

Thanks,
D

Subject: Range in Matlab

From: Anh Huy Phan

Date: 19 Jan, 2008 23:34:02

Message: 2 of 5

"deluded.soul@gmail.com" <deluded.soul@gmail.com> wrote in
message <0385fb35-5bb5-4de5-9034-
b2ac109e3308@l32g2000hse.googlegroups.com>...
> Hi everyone,
>
> I need to find the min and max value in a subset of an
array
>
> normally, if I have a 2D array called x, I can do
>
> min(min(x)) and this works fine...
>
> However, if this array is 128 X 128, I just want the
minimum between
> the indexes [5, 5,] and [123, 123]... How can I specify
this?
>
> Thanks,
> D

rowind = [5 123];
colind = [5 123];
m = min(x(sub2ind(size(x),rowind,colind)))

HTH

Anh Huy Phan
RIKEN - BSI

Subject: Range in Matlab

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 20 Jan, 2008 01:37:58

Message: 3 of 5

In article <0385fb35-5bb5-4de5-9034-b2ac109e3308@l32g2000hse.googlegroups.com>,
deluded.soul@gmail.com <deluded.soul@gmail.com> wrote:
>However, if this array is 128 X 128, I just want the minimum between
>the indexes [5, 5,] and [123, 123]... How can I specify this?

min(min(thearray(5:123,5:123)))
--
  "There are some ideas so wrong that only a very intelligent person
  could believe in them." -- George Orwell

Subject: Range in Matlab

From: Nicolas Jeannequin

Date: 20 Jan, 2008 03:51:05

Message: 4 of 5

Hi,

you can do:
index_range=[5:123];
solution = min(min(x(indices,indices)));

Cheers,
Nicolas

On Sat, 19 Jan 2008, deluded.soul@gmail.com wrote:

> Hi everyone,
>
> I need to find the min and max value in a subset of an array
>
> normally, if I have a 2D array called x, I can do
>
> min(min(x)) and this works fine...
>
> However, if this array is 128 X 128, I just want the minimum between
> the indexes [5, 5,] and [123, 123]... How can I specify this?
>
> Thanks,
> D
>

Subject: Range in Matlab

From: Nicolas Jeannequin

Date: 20 Jan, 2008 04:09:53

Message: 5 of 5

Typo:
indices=index_range;

On Sun, 20 Jan 2008, Nicolas Jeannequin wrote:

> Hi,
>
> you can do:
> index_range=[5:123];
> solution = min(min(x(indices,indices)));
>
> Cheers,
> Nicolas
>
> On Sat, 19 Jan 2008, deluded.soul@gmail.com wrote:
>
>> Hi everyone,
>>
>> I need to find the min and max value in a subset of an array
>>
>> normally, if I have a 2D array called x, I can do
>>
>> min(min(x)) and this works fine...
>>
>> However, if this array is 128 X 128, I just want the minimum between
>> the indexes [5, 5,] and [123, 123]... How can I specify this?
>>
>> Thanks,
>> D
>>
>

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com