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:
finding minimum and maximum

Subject: finding minimum and maximum

From: Snow White

Date: 20 Mar, 2009 19:40:22

Message: 1 of 4

Hello,

I have written the following piece of code to find minimum and maximum values of some experimental data:

  I_max=max(z(:))
            I_min=min(z(:))

I get the following values for max it works fine but for min it return a 0 although it should be 26 or greater than 0.

I_max =

   39.3541


I_min =

     0

Can anyone help me with this. Please

Subject: finding minimum and maximum

From: Matt Fig

Date: 20 Mar, 2009 19:51:01

Message: 2 of 4


z = zeros(3);
z(9) = 39.3541;
z(5) = 26

I_min = min(z(z>0))

Subject: finding minimum and maximum

From: Snow White

Date: 20 Mar, 2009 20:10:19

Message: 3 of 4

size of z is as follows

z =

     1 1 10

i have used squeeze for plotting which is as follows:
plot(polang,squeeze(z(x,y,:)),'kx');
                                end
                                    hold on;
            I_max=max(z(:))
            I_min=min(z(:))
            z=size(z(x,y,:))

"Matt Fig" <spamanon@yahoo.com> wrote in message <gq0s35$qf4$1@fred.mathworks.com>...
>
> z = zeros(3);
> z(9) = 39.3541;
> z(5) = 26
>
> I_min = min(z(z>0))

Subject: finding minimum and maximum

From: someone

Date: 20 Mar, 2009 21:24:01

Message: 4 of 4

"Snow White" <gulesaman@gmail.com> wrote in message <gq0rf6$f1e$1@fred.mathworks.com>...
> Hello,
>
> I have written the following piece of code to find minimum and maximum values of some experimental data:
>
> I_max=max(z(:))
> I_min=min(z(:))
>
> I get the following values for max it works fine but for min it return a 0 although it should be 26 or greater than 0.
>
> I_max =
>
> 39.3541
>
>
> I_min =
>
> 0
>
> Can anyone help me with this. Please

Why do you think it should be 26?
If you want to exclude zeros from the min, use Matt's suggestion.

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