Sign in to follow this  
Followers 0
ScriptCrafter

2D Array Problem

2 posts in this topic

#1 ·  Posted (edited)

Hello,

I am trying to do the following:

Take values in two defined array

$array1[8]

$array2[255]

Where

$array1[0] = 0

$array1[1] = 32

$array1[2] = 64

$array1[3] = 96

$array1[4] = 128

$array1[5] = 160

$array1[6] = 192

$array1[7] = 224

And

$array2[255] = 1 through 255

And loop those values to do the following:

FileWrite ($FILE, 0.0)

FileWrite ($FILE, 0.32)

FileWrite ($FILE, 0.64)

until its done with $array1 and does

FileWrite ($File, 1.0)

FileWrite ($File, 1.32)

FileWrite ($File, 1.64)

So on and so forth all the way through 255 for $array2

Any help is very much appreciated

Also if there was a way to concantante those values and store to one array that would be the cats meow :-)

Thank You!

Edited by ScriptCrafter

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi,

Dim $array1[8], $array2[256]
;$array1[0] = 0
;$array1[1] = 32
;$array1[2] = 64
;$array1[3] = 96
;$array1[4] = 128
;$array1[5] = 160
;$array1[6] = 192
;$array1[7] = 224

$count = 0
For $i = 0 To 224 Step 32
    $array1 [$count] = $i
    $count += 1
Next

For $i = 0 To 255
    $array2 [$i] = $i
Next

$FILE = FileOpen ("c:\testlog.txt", 1)

For $i = 0 To UBound ($array2) - 1
    For $j = 0 To UBound ($array1) - 1
        FileWriteLine ($FILE, $array2 [$i] & "." & $array1 [$j])
    Next
Next
FileClose ($FILE)
ShellExecute ("notepad", "c:\testlog.txt")

;-))

Stefan

Edit: Add automatic creation of arrays.

Edited by 99ojo

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