Jump to content
Sign in to follow this  
LeThanh201

Help me add 2 array

Recommended Posts

LeThanh201

Hi, all!

I have 2 arrays 1D but I can't concatenate that they are in 2 different columns(as 2D array). Help me, please!!!

Share this post


Link to post
Share on other sites
Manko

Hi, all!

I have 2 arrays 1D but I can't concatenate that they are in 2 different columns(as 2D array). Help me, please!!!

Hi!

Redim $somearray[Ubound($somearray,1)][2]oÝ÷ Úf¤zË(æ«­¬¶w­kÚ笶§Ê¡j÷­¢j/zö¥¹ë"Ú-ërݲZ-~º&¶¨¶«jºÚÊ)Ú~å¢ZºÚ"µÍÜ  ÌÍÚÏLÈXÝ[
    ÌÍÜÛÛYX^KJKLB  ÌÍÜÛÛYX^VÉÌÍÚ×VÌWOIÌÍÜÛÛY[Ý^VÉÌÍÚ×B^

maybe you should also check which array is longer, if not equal, and use that for main...

/Manko

Edited by Manko

Yes i rush things! (I sorta do small bursts inbetween doing nothing.) Things I have rushed and reRushed:* ProDLLer - Process manager - Unload viri modules (dll) and moore...* _WinAPI_ProcessListOWNER_WTS() - Get Processes owner list...* _WinAPI_GetCommandLineFromPID() - Get commandline of target process...* _WinAPI_ThreadsnProcesses() Much info if expanded - optional Indented "Parent/Child"-style Processlist. Moore to come... eventually...

Share this post


Link to post
Share on other sites
Malkey

This seems to work

#include <array.au3>

Local $aArray1[15] = [1, 3, 4, 5, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 25]
Local $aArray2[9] = ["A", "B", "C", "D", "E", "F", "G", "H", "I"]

$ans = _Join2ArraysTo2dArray($aArray1, $aArray2)
_ArrayDisplay($ans)

Func _Join2ArraysTo2dArray(ByRef $array1, ByRef $array2)
    If UBound($array2) > UBound($array1) Then       
        Local $results[UBound($array2)][2]
        Local $iSize = UBound($array2) - 1
    Else
        Local $results[UBound($array1)][2]
        Local $iSize = UBound($array1) - 1
    EndIf

    For $i = 0 To $iSize
        If UBound($array1) > $i Then $results[$i][0] = $array1[$i]
        If UBound($array2) > $i Then $results[$i][1] = $array2[$i]
    Next
    Return $results
EndFunc   ;==>_Join2arraysTo2dArray

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.