Sign in to follow this  
Followers 0
ddeerr

merging two array

9 posts in this topic

Hi,

All in the subject, for me just 2 simple one dimension array will be helpful.


MsgBox(0, "Steven Seagal", "Les poches bourrées de Pesos")

Share this post


Link to post
Share on other sites



Hi,

All in the subject, for me just 2 simple one dimension array will be helpful.

there is slowness on my internet connexion sorry i click two time :'|


MsgBox(0, "Steven Seagal", "Les poches bourrées de Pesos")

Share this post


Link to post
Share on other sites

maybe i can make an array add on the first array with each value of the second :lmao:

i'll beginning this :ph34r:


MsgBox(0, "Steven Seagal", "Les poches bourrées de Pesos")

Share this post


Link to post
Share on other sites

maybe i can make an array add on the first array with each value of the second :lmao:

i'll beginning this :ph34r:

Maybe post what you already have?

Adding 2 arrays should be pretty easy to do...


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Maybe post what you already have?

Adding 2 arrays should be pretty easy to do...

Here is the wanted code section :

; this getting is for getting floders thru regedit without knowing were the path beginning

$tempHistoArray = recupereClefs($a)     ; this function return a 1 dimension array with random total size
$histoArrayS = $tempHistoArray
ControlSend($wh, "", 1, "{RIGHT}")
$aTemp = ControlGetText($wh, "", 3)
$aTemp = StringTrimLeft($aTemp, $cNomRepRegistre)   ; i get a string representing a regedit path

If $aTemp = $a Or StringInStr($aTemp, $a, 1) <> 0 Then      ; $a is the first path i get in my programm beginning ( 600 lines :\ )
    ControlSend($wh, "", 1, "{RIGHT}")
    $aTemp = ControlGetText($wh, "", 3)
    $aTemp = StringTrimLeft($aTemp, $cNomRepRegistre)
    If $aTemp <> $a And StringInStr($aTemp, $a, 1) <> 0 Then
        $tempHistoArray = recupereClefs($tempa)
        
        ; here i need to merge datas from $tempsHistoArray with $histoArrayS
        
    EndIf
EndIf

MsgBox(0, "Steven Seagal", "Les poches bourrées de Pesos")

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

example on adding 2 arrays:

#include<array.au3>
Dim $array1[5] = [1, 2, 3, 4, 5]
Dim $array2[5] = [6, 7, 8, 9, 10]
; add Array2 to Array1
ReDim $array1[UBound($array1) + UBound($array2) ]
For $x = 0 To UBound($array2) - 1
    $array1[UBound($array1) - UBound($array2) + $x] = $array2[$x]
Next
_ArrayDisplay($array1, "test")
Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

example on adding 2 arrays:

#include<array.au3>
Dim $array1[5] = [1, 2, 3, 4, 5]
Dim $array2[5] = [6, 7, 8, 9, 10]
; add Array2 to Array1
ReDim $array1[UBound($array1) + UBound($array2) ]
For $x = 0 To UBound($array2) - 1
    $array1[UBound($array1) - UBound($array2) + $x] = $array2[$x]
Next
_ArrayDisplay($array1, "test")oÝ÷ Ûú®¢×­Æ'hm¶§Ú+x8¦¶h¶­nëbv­)¶¬jëh×6
#include<array.au3>
Dim $array1[5] = [1, 2, 3, 4, 5]
Dim $array2[5] = [6, 7, 8, 9, 10]
; add Array2 to Array1
For $x = 0 To UBound($array2) - 1
    _ArrayAdd($array1, $array2[$x])
Next
_ArrayDisplay($array1, "test")

I was asking for time performance in code execution, maybe your one is much faster ?


MsgBox(0, "Steven Seagal", "Les poches bourrées de Pesos")

Share this post


Link to post
Share on other sites

tx i don't think to reDim to do that but i do it like this :

#include<array.au3>
Dim $array1[5] = [1, 2, 3, 4, 5]
Dim $array2[5] = [6, 7, 8, 9, 10]
; add Array2 to Array1
For $x = 0 To UBound($array2) - 1
    _ArrayAdd($array1, $array2[$x])
Next
_ArrayDisplay($array1, "test")

I was asking for time performance in code execution, maybe your one is much faster ?

Both ways will work.

_ArrayAdd() will do a redim each time you add a record so depending on the sizes of the arrays, there could be a performance difference.


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Both ways will work.

_ArrayAdd() will do a redim each time you add a record so depending on the sizes of the arrays, there could be a performance difference.

so i take your method tx


MsgBox(0, "Steven Seagal", "Les poches bourrées de Pesos")

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