Cancel
Showing results for 
Search instead for 
Did you mean: 

Find smalles value variable

Creator
Creator

Hi everyone, 

 

I have the following problem. I defined four different variables in a method. For example, they have the values respectively 1, 2, 3 and 4. Which word/method do I use to find the variable with the smallest value?

 

Regards,

 

Michael

6 REPLIES

Re: Find smalles value variable

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

the method is "min", but you can only pass two parameters. For 4 numbers, you need to combine 3 min-Methods:

 

min(1,min(2,min(3,4)))
Steffen Bangsow
freelance simulation specialist  
web: www.bangsow.eu
mail: steffen@bangsow.net

Re: Find smalles value variable

Siemens Phenom Siemens Phenom
Siemens Phenom

I would use the function min, which returns the smaller of two values.

Example:

 

is
    a,b,c,d,m: real;
do
    a := z_uniform(1,0,10);
    b := z_uniform(1,0,10);
    c := z_uniform(1,0,10);
    d := z_uniform(1,0,10);
    
    m := min(min(a,b), min(c,d));
    
    print a, " ", b, " ", c, " ", d, "  min=", m;
end;

_________________________________________________________________
Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution.

Re: Find smalles value variable

Creator
Creator

Thank you, Michael and Steffen!

Re: Find smalles value variable

Valued Contributor
Valued Contributor

Hello,

 

Is it possible to find the "min" of a Date in a tablefile?

 

Say I have a column with three dates as follows:

 

2014/06/01

2014/07/01

2003/03/25

 

How would I find the "smallest" date (2003/03/25) from that column?

 

Thank you.

 

Re: Find smalles value variable

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi ET_Boys,

 

the table has a method min which you can use.

 

Just have a look in the online documention how to use it.

Regards,

Ralf
------------------------------------------------------------------------------------------------------
Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution.

Re: Find smalles value variable

Valued Contributor
Valued Contributor

Hello RalfTobel,

 

Do you mean the function TableFile.min() ? This function unfortunately only accepts integers and real as input parameters but not dates without time.