Jump to content

Recommended Posts

Posted

Hi all, can some PLEASE point me into the right direction.

Ok, here is what I am doing. I have a list of values in Array. Is there a command that will compute the difference between the lowest and the highest values. Some of these values may/are in negative.

Unfortunately I left the actual script at work, but these are some of the things that I have tried...

$minvalue = _ArrayMin($arrdata, 1) .... This does get me min value from Array.

$maxvalue = _ArrayMax($arrdata, 1) .... This does get me max value from Array.

$endvalue = $maxvalue - $minvalue .... This vaule is always zero regardless min and max vaules.

HELP HELP HELP !!!

Thanks, Monty.

Posted

Well, ... show your array, please.

Unfortunately I left the actual script at work and I am already kicking myself for it.

Posted (edited)

Hi all, can some PLEASE point me into the right direction.

Ok, here is what I am doing. I have a list of values in Array. Is there a command that will compute the difference between the lowest and the highest values. Some of these values may/are in negative.

Unfortunately I left the actual script at work, but these are some of the things that I have tried...

$minvalue = _ArrayMin($arrdata, 1) .... This does get me min value from Array.

$maxvalue = _ArrayMax($arrdata, 1) .... This does get me max value from Array.

$endvalue = $maxvalue - $minvalue .... This vaule is always zero regardless min and max vaules.

HELP HELP HELP !!!

Thanks, Monty.

Hi,

quite funny. I think there is a problem with_MinArray, if you have positiv values:

#include <array.au3>
Dim $arrdata [3] = [-1, 3]

$minvalue = _ArrayMin($arrdata, 1)
$maxvalue = _ArrayMax($arrdata, 1)
$endvalue = $maxvalue - $minvalue
MsgBox (0,"", $maxvalue & @CRLF & $minvalue & @CRLF & $endvalue)

works, even with Dim $arrdata [3] = ["-1", "3"].

#include <array.au3>
Dim $arrdata [3] = [1, 3]

$minvalue = _ArrayMin($arrdata, 1)
$maxvalue = _ArrayMax($arrdata, 1)
$endvalue = $maxvalue - $minvalue
MsgBox (0,"", $maxvalue & @CRLF & $minvalue & @CRLF & $endvalue)

doesn't work!?! I got nothing for $minvalue.

>_<

Stefan

Edited by 99ojo
Posted (edited)

Hi,

quite funny. I think there is a problem with_MinArray, if you have positiv values:

#include <array.au3>
Dim $arrdata [3] = [-1, 3]

$minvalue = _ArrayMin($arrdata, 1)
$maxvalue = _ArrayMax($arrdata, 1)
$endvalue = $maxvalue - $minvalue
MsgBox (0,"", $maxvalue & @CRLF & $minvalue & @CRLF & $endvalue)

works, even with Dim $arrdata [3] = ["-1", "3"].

#include <array.au3>
Dim $arrdata [3] = [1, 3]

$minvalue = _ArrayMin($arrdata, 1)
$maxvalue = _ArrayMax($arrdata, 1)
$endvalue = $maxvalue - $minvalue
MsgBox (0,"", $maxvalue & @CRLF & $minvalue & @CRLF & $endvalue)

doesn't work!?! I got nothing for $minvalue.

>_<

Stefan

#include <array.au3>
Dim $arrdata [3] = [1, 3]

$minvalue = _ArrayMin($arrdata, 1, 0, UBound($arrdata))
$maxvalue = _ArrayMax($arrdata, 1, 0, UBound($arrdata))
$endvalue = $maxvalue - $minvalue
MsgBox (0,"", $maxvalue & @CRLF & $minvalue & @CRLF & $endvalue)
Edited by Yashied
Posted

#include <array.au3>
Dim $arrdata [3] = [1, 3]

$minvalue = _ArrayMin($arrdata, 1, 0, UBound($arrdata))
$maxvalue = _ArrayMax($arrdata, 1, 0, UBound($arrdata))
$endvalue = $maxvalue - $minvalue
MsgBox (0,"", $maxvalue & @CRLF & $minvalue & @CRLF & $endvalue)

Hi,

this makes me lough.

Why does it work with Dim $arrdata [3] = [-1, 3] and not with Dim $arrdata [3] = [1, 3] >_<

But i think your code might be the solution for Monty. :(

Stefan

Posted

Hi,

quite funny. I think there is a problem with_MinArray, if you have positiv values:

#include <array.au3>
Dim $arrdata [3] = [-1, 3]

$minvalue = _ArrayMin($arrdata, 1)
$maxvalue = _ArrayMax($arrdata, 1)
$endvalue = $maxvalue - $minvalue
MsgBox (0,"", $maxvalue & @CRLF & $minvalue & @CRLF & $endvalue)

works, even with Dim $arrdata [3] = ["-1", "3"].

#include <array.au3>
Dim $arrdata [3] = [1, 3]

$minvalue = _ArrayMin($arrdata, 1)
$maxvalue = _ArrayMax($arrdata, 1)
$endvalue = $maxvalue - $minvalue
MsgBox (0,"", $maxvalue & @CRLF & $minvalue & @CRLF & $endvalue)

doesn't work!?! I got nothing for $minvalue.

:(

Stefan

You initialized your array with THREE elements. Since [2] isn't initialized, it's equivalent to 0. So the result is max=3 min="" diff=3.

>_<

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Posted

You initialized your array with THREE elements. Since [2] isn't initialized, it's equivalent to 0. So the result is max=3 min="" diff=3.

>_<

Hi,

I'm sitting here like a stupid .......

Such a silly thing.

Thanks for opening my eyes..........

:(

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...