Monty Posted August 5, 2009 Share Posted August 5, 2009 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 More sharing options...
Yashied Posted August 5, 2009 Share Posted August 5, 2009 Well, ... show your array, please. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
Monty Posted August 5, 2009 Author Share Posted August 5, 2009 Well, ... show your array, please.Unfortunately I left the actual script at work and I am already kicking myself for it. Link to comment Share on other sites More sharing options...
99ojo Posted August 5, 2009 Share Posted August 5, 2009 (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 August 5, 2009 by 99ojo Link to comment Share on other sites More sharing options...
Yashied Posted August 5, 2009 Share Posted August 5, 2009 (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 August 5, 2009 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
99ojo Posted August 5, 2009 Share Posted August 5, 2009 #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 More sharing options...
PsaltyDS Posted August 5, 2009 Share Posted August 5, 2009 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 More sharing options...
99ojo Posted August 5, 2009 Share Posted August 5, 2009 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now