Jump to content

Array


 Share

Recommended Posts

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

#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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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..........

:(

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...