Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
built-in, standard range function?

Subject: built-in, standard range function?

From: IceHaven

Date: 31 Jul, 2013 21:33:11

Message: 1 of 4

does the basic matlab program have a range function that computes max(array)-min(array) of an array? i found that there's a range function in the statistics toolbox, but i'd expect there to be one in the regular program as well, right?

Subject: built-in, standard range function?

From: Barry Williams

Date: 1 Aug, 2013 11:53:10

Message: 2 of 4

"IceHaven" wrote in message <ktbvqn$173$1@newscl01ah.mathworks.com>...
> does the basic matlab program have a range function that computes max(array)-min(array) of an array? i found that there's a range function in the statistics toolbox, but i'd expect there to be one in the regular program as well, right?

rangex=max(max(x))-min(min(x));

Barry

Subject: built-in, standard range function?

From: dpb

Date: 1 Aug, 2013 12:44:37

Message: 3 of 4

On 8/1/2013 6:53 AM, Barry Williams wrote:
> "IceHaven" wrote in message <ktbvqn$173$1@newscl01ah.mathworks.com>...
>> does the basic matlab program have a range function that computes
>> max(array)-min(array) of an array? i found that there's a range
>> function in the statistics toolbox, but i'd expect there to be one in
>> the regular program as well, right?
>
> rangex=max(max(x))-min(min(x));

Can eliminate the nested calls w/

rangex=max(x(:))-min(x(:));

--

Subject: built-in, standard range function?

From: Barry Williams

Date: 1 Aug, 2013 19:29:16

Message: 4 of 4

dpb <none@non.net> wrote in message <ktdl81$f6c$1@speranza.aioe.org>...
> On 8/1/2013 6:53 AM, Barry Williams wrote:
> > "IceHaven" wrote in message <ktbvqn$173$1@newscl01ah.mathworks.com>...
> >> does the basic matlab program have a range function that computes
> >> max(array)-min(array) of an array? i found that there's a range
> >> function in the statistics toolbox, but i'd expect there to be one in
> >> the regular program as well, right?
> >
> > rangex=max(max(x))-min(min(x));
>
> Can eliminate the nested calls w/
>
> rangex=max(x(:))-min(x(:));
>
> --
>
 You're right, dpb; your solution is more elegant.
Barry

Tags for this Thread

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.

Contact us