Jump to content

way to add to a multi-dimension array?


 Share

Recommended Posts

I am trying this with a 2D array (to learn) but am then going to place it in my script using a 3d array...this code doesnt work by any means...

#include <Array.au3>
Dim $avArray[10][2]
$avArray[0][0] = "JPM"
$avArray[1][0] = "Holger"
$avArray[2][0] = "Jon"
$avArray[3][0] = "Larry"
$avArray[4][0] = "Jeremy"
$avArray[5][0] = "Valik"
$avArray[6][0] = "Cyberslug"
$avArray[7][0] = "Nutster"
$avArray[8][0] = "JdeB"
$avArray[9][0] = "Tylo"
_ArrayDisplay( $avArray, "Whole array" )
dim $a[2][2] = [["41","a"],["32","12"]]
_ArrayAdd($avArray[0], $a)
_ArrayDisplay( $avArray, "Updated Array" )
Edited by ReaImDown
[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]
Link to comment
Share on other sites

  • Moderators

ArrayAdd2D by Ivan: http://www.autoitscript.com/forum/index.ph...st&p=217707

But it seems you don't quite understand 2d arrays (when you tried to pass array element 0 ass the array, you have to pass the whole array)... It seems you more want an _ArrayAddArray2D to me.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

ArrayAdd2D by Ivan: http://www.autoitscript.com/forum/index.ph...st&p=217707

But it seems you don't quite understand 2d arrays (when you tried to pass array element 0 ass the array, you have to pass the whole array)... It seems you more want an _ArrayAddArray2D to me.

I was only using a 2d array to learn from, I guess if its going to be complicated, I may as well used multiple arrays (but it stands a good chance of slowing down my script) due to the fact that I actually need a 3D array
[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]
Link to comment
Share on other sites

The _ArrayDisplay() UDF only works with 1D or 2D arrays, not 3D or more.

The _ArrayAdd() UDF only works with 1D arrays, not 2D or more.

There are many examples in the forums of various functions for higher dimensions in arrays. One recent example I did was here.

:)

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

Dim $z[101][101][101]
For $i=1 To 100
    For $i2=1 To 100
        For $i3=1 To 100
            $z[$i][$i2][$i3]=Random(0,1000,1)
            ToolTip("1st dimension:"&$i&@CRLF & _
                    "2nd dimension:"&$i2&@CRLF & _
                    "3rd dimension:"&$i3& " , "&$z[$i][$i2][$i3],0,0)
            Sleep(20)
        Next
    Next
Next

Heres' a little example with a 3 dim array :)

Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro

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