Sign in to follow this  
Followers 0
Mirus

Bidimensional Array

4 posts in this topic

Hi i'd like to know how to put in an array, by an imputbox, some data. 

#include <Array.au3>
   local $var1
   
  $var1 =InputBox( "", "insert number of row")
  $var2 = 5 ; number of col
 Local $array[$var1] [5]
 
For $I = 0 To $var1-1 step 1
  
   
   
   $array[$I][$I] = inputbox("", "insert value of first row")
  next

_ArrayDisplay($array)

that's what i've done. what i want to do is put the first value on col1 row1 [0][0] then he ask me again the $value and i want to put that (it's a different number) on col2 row1 [0][1]. how can i do?

thank you.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

not sure if this will do ya:

#include <Array.au3>
local $var1

While Not Int($var1)
    $var1 = InputBox("","insert number of row")
WEnd
Local $array[$var1][5]

For $i=0 To UBound($array,2)-1
    $array[0][$i] = inputbox("", "insert value of first row")
next
_ArrayDisplay($array)

explain it better, if not.

In case you want to manually populate everything:

; to add all data:
For $i=0 To UBound($array)-1
    For $j=0 To UBound($array,2)-1
        $array[$i][$j] = inputbox("", "insert value of row=[" & $i+1 & "], col=[" & $j+1 & "]")
    Next
next
_ArrayDisplay($array)
Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

; to add all data:
For $i=0 To UBound($array)-1
    For $j=0 To UBound($array,2)-1
        $array[$i][$j] = inputbox("", "insert value of row=[" & $i+1 & "], col=[" & $j+1 & "]")
    Next
next
_ArrayDisplay($array)

thank you it works, but i don't understand what means the 2 on "For $j=0 To UBound($array,2)-1" i know that it modify the dim of the array but why 2? can you explaine that ? 

i'm new to AutoIt and i remember ubound from vb but not well.

Edited by Mirus

Share this post


Link to post
Share on other sites

helpfile:

UBound ( Array [, Dimension] )

Parameters

 

Array The array variable which is being queried. Dimension [optional] Which dimension of a multi-dimensioned array to report the size of. Default is 1, which is the first dimension. If this parameter is 0, the number of subscripts in the array is returned.

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
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
Sign in to follow this  
Followers 0