kcvinu Posted September 25, 2015 Share Posted September 25, 2015 (edited) Hi all, I sometimes wanted these functionality in _ArrayAdd function. I still don't know how to achieve it with _ArrayAdd. So i have wrote one. Please tell me if any better ways to do this.expandcollapse popup; #FUNCTION# ==================================================================================================================== ; Name ..........: ArrayADD_2D ; Description ...: This Function adds either one column or one row to an existing array and put data from given array to it. ; Syntax ........: ArrayADD_2D(Byref $aArrayTochange, $aValueArray[, $Flag = $AddCol]) ; Parameters ....: $aArrayTochange - [in/out] an array you need to change. Must be a 2D Array ; $aValueArray - an array you need to insert into the first array. Must be a 1D Array ; $Flag - [optional] A flag value. Default is $AddCol. This value determins where to put the second array to first array. $AddCol puts all data to a new column and $AddRow puts all data to a new row. ; Return values .: If success, it will return the changed array. ; Errors - : -1 = First array is not an array ; : -2 = Second array is not an array ; : -3 = First array is not a 2D ; : -4 = Second array is not a 1D array ; : -5 = Second array doesn't have enough elements or more elements to add the first array ; : -6 = $Flag error ; Author ........: kcvinu ; Modified ......: sep 2015 ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: ArrayADD_2D($aArray1, $aArray2, $AddRow) ; =============================================================================================================================== Global Enum $AddCol, $AddRow Func ArrayADD_2D(ByRef $aArrayTochange, $aValueArray, $Flag = $AddCol) If Not IsArray($aArrayTochange) Then Return -1 If Not IsArray($aValueArray) Then Return -2 If UBound($aArrayTochange, $UBOUND_DIMENSIONS) <> 2 Then Return -3 If UBound($aValueArray, $UBOUND_DIMENSIONS) <> 1 Then Return -4 If $Flag = 0 Then ; we need to add 1 column and put the data in each row $iRows = UBound($aArrayTochange, $UBOUND_ROWS) - 1 $iCols = UBound($aArrayTochange, $UBOUND_COLUMNS) - 1 $iUb_Value = UBound($aValueArray) - 1 If $iRows <> $iUb_Value Then Return -5 ReDim $aArrayTochange[$iRows + 1][$iCols + 2] $iNewCol = UBound($aArrayTochange, $UBOUND_COLUMNS) - 1 For $i = 0 To $iRows $aArrayTochange[$i][$iNewCol] = $aValueArray[$i] Next Return $aArrayTochange ElseIf $Flag = 1 Then ; we need add one row and put the data in each column $iRows = UBound($aArrayTochange, $UBOUND_ROWS) - 1 $iCols = UBound($aArrayTochange, $UBOUND_COLUMNS) - 1 $iUb_Value = UBound($aValueArray) - 1 If $iCols <> $iUb_Value Then Return -5 ReDim $aArrayTochange[$iRows + 2][$iCols + 1] $iNewRow = UBound($aArrayTochange, $UBOUND_ROWS) - 1 For $i = 0 To $iCols $aArrayTochange[$iNewRow][$i] = $aValueArray[$i] Next Return $aArrayTochange Else Return -6 EndIf EndFunc ;==>ArrayADD_2D Edited September 25, 2015 by kcvinu Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 25, 2015 Moderators Share Posted September 25, 2015 kcvinu,I still don't know how to achieve it with _ArrayAddYou can do it like this:#include <Array.au3> Global $aBase[3][3] = [["0-0", "0-1", "0-2"], _ ["1-0", "1-1", "1-2"], _ ["2-0", "2-1", "2-2"]] Global $aAdd[1][3] = [["A", "B", "C"]] _ArrayDisplay($aBase, "", Default, 8) $aBaseArray = $aBase _ArrayAdd($aBaseArray, $aAdd) _ArrayDisplay($aBaseArray, "", Default, 8) $aBaseArray = $aBase _ArrayTranspose($aBaseArray) _ArrayAdd($aBaseArray, $aAdd) _ArrayTranspose($aBaseArray) _ArrayDisplay($aBaseArray, "", Default, 8)M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
kcvinu Posted September 25, 2015 Author Share Posted September 25, 2015 @Melba23 Thanks. Doubts cleared. But among these two methods which one you coose ? Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 25, 2015 Moderators Share Posted September 25, 2015 kcvinu,As I rewrote most of the current functions of the Array library, which do you think?M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
kcvinu Posted September 25, 2015 Author Share Posted September 25, 2015 @Melba , In that perspective, i know the answer. But then you need to use more than one line of code. But using this function, you can do your job in one line of code. Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 25, 2015 Moderators Share Posted September 25, 2015 kcvinu,But using this function, you can do your job in one line of code.But so can I:#include <Array.au3> Global Enum $eAddRow, $eAddCol Global $aBase[3][3] = [["0-0", "0-1", "0-2"], _ ["1-0", "1-1", "1-2"], _ ["2-0", "2-1", "2-2"]] Global $aAdd[1][3] = [["A", "B", "C"]] _ArrayDisplay($aBase, "", Default, 8) $aBaseArray = $aBase _ArrayAdd_Ex($aBaseArray, $aAdd) _ArrayDisplay($aBaseArray, "", Default, 8) $aBaseArray = $aBase _ArrayAdd_Ex($aBaseArray, $aAdd, $eAddCol) _ArrayDisplay($aBaseArray, "", Default, 8) Func _ArrayAdd_Ex(ByRef $aBaseArray, $aAdd, $iLocation = $eAddRow) If $iLocation = $eAddCol Then _ArrayTranspose($aBaseArray) _ArrayAdd($aBaseArray, $aAdd) If $iLocation = $eAddCol Then _ArrayTranspose($aBaseArray) EndFuncM23 kcvinu 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
kcvinu Posted September 25, 2015 Author Share Posted September 25, 2015 (edited) @Melba23 That's a smart way. Now, i would like to check the perfomance speed of both method. Just for a curiosity. Edit - @@Melba23 You forgot to return the array from function. Edited September 26, 2015 by kcvinu Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only) Link to comment Share on other sites More sharing options...
iamtheky Posted September 25, 2015 Share Posted September 25, 2015 cant tell if this is the same way you are doing it, but heres how i would add the array as additional columns to the base#include <Array.au3> Global $aBase[3][3] = [["0-0", "0-1", "0-2"], _ ["1-0", "1-1", "1-2"], _ ["2-0", "2-1", "2-2"]] Global $aAdd[3][3] = [["A", "B", "C"] , _ ["D", "E", "F"] , _ ["G", "H", "I"]] redim $aBase[ubound($aBase)][ubound($aBase , 2) + ubound($aAdd , 2)] For $k = 0 to ubound($aAdd) - 1 For $i = 0 to ubound($aBase) - 1 $aBase[$i][ubound($aBase , 2) - ubound($aAdd , 2) + $k] = $aAdd[$k][$i] Next Next _ArrayDisplay($aBase) kcvinu 1 ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
kcvinu Posted September 25, 2015 Author Share Posted September 25, 2015 @boththose , Thanks for the reply. Actually i just want to add either a column or a row. Because, sometimes we want to add data to existing 2D array. Your code shows me that combing 2 2D arrays into one. Well, it is really a smart way. Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only) Link to comment Share on other sites More sharing options...
iamtheky Posted September 25, 2015 Share Posted September 25, 2015 (edited) My apologies, I didnt read the comments in your UDF that input would be a 1D array. But I totally stole the 2D from Melba, his is just a one line 2D. If you build a race i would be interested in how mine places. And for rows just swap all the dimensions, and all the ubounds, here it is all togetherexpandcollapse popup#include <Array.au3> Global $aFirst[3][3] = [["0-0", "0-1", "0-2"], _ ["1-0", "1-1", "1-2"], _ ["2-0", "2-1", "2-2"]] Global $aSecond[3][3] = [["A", "B", "C"] , _ ["D", "E", "F"] , _ ["G", "H", "I"]] $aRowSmash = _2Dsmash($aFirst , $aSecond, 0) _ArrayDisplay($aRowSmash , "RowSmash") $aColumnSmash = _2Dsmash($aFirst , $aSecond, 1) _ArrayDisplay($aColumnSmash, "ColumnSmash") Func _2Dsmash($aBase , $aAdd , $flag = 0) If $flag = 0 Then redim $aBase[ubound($aBase) + ubound($aAdd)][ubound($aBase, 2)] For $k = 0 to ubound($aAdd , 2) - 1 For $i = 0 to ubound($aBase , 2) - 1 $aBase[ubound($aBase) - ubound($aAdd) + $k][$i] = $aAdd[$k][$i] Next Next Else redim $aBase[ubound($aBase)][ubound($aBase , 2) + ubound($aAdd , 2)] For $k = 0 to ubound($aAdd) - 1 For $i = 0 to ubound($aBase) - 1 $aBase[$i][ubound($aBase , 2) - ubound($aAdd , 2) + $k] = $aAdd[$k][$i] Next Next EndIf return $aBase EndFunc ;2Dsmash **If you are entering rows, the arrays must have the same number of columns, if entering columns they must have the same number of rows. While _arrayadd would throw a nice error 3, my solutions will just ignore all of the excess. Edited September 25, 2015 by boththose ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
kcvinu Posted September 26, 2015 Author Share Posted September 26, 2015 (edited) @boththose I check my function's speed with this code. #include <Array.au3> Local $aArray1 = [[5, 6, 7, 1, 0], [8, 9, 10, 1, 0], [11, 14, 15, 1, 0], [16, 17, 18, 1, 0]] Local $aArray2 = [1, 3, 4, 4, 6] Local $tmr = TimerInit() Local $aResultArray = ArrayADD_2D($aArray1, $aArray2, 1) ; Items are added as an extra row _ArrayDisplay($aResultArray, TimerDiff($tmr))And this is the result = 0.0615793200853584Edit - I have addedd my function to Array.au3 UDF in my Include folder.Edit 2 - @boththose , can you check your function with this code. Because, i didn't get any result from it. Edited September 26, 2015 by kcvinu Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 26, 2015 Moderators Share Posted September 26, 2015 All,I have addedd my function to Array.au3 UDF.Just to be clear, kcvinu has added the function to his copy of the Array library, not the version that is downloaded with AutoIt.And this is not a good idea - read the Adding UDFs to AutoIt and SciTE tutorial in the Wiki to see why, and how it should be done.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
kcvinu Posted September 26, 2015 Author Share Posted September 26, 2015 @Melba23 I didn't think about the impact of my above comment. Sorry for the inconvinience. Let me make clear that in my comment. And plus that, your function didn't worked me in the above example. Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 26, 2015 Moderators Share Posted September 26, 2015 kcvinu,Thanks. for clarifying your remark.The example I posted works fine for me. And I did not forget to return the function, it is passed as a ByRef parameter and so the original array is modified directly from within the function. Perhaps the Variables - using Global, Local, Static and ByRef tutorial in the Wiki might be a useful read.M23 kcvinu 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
iamtheky Posted September 26, 2015 Share Posted September 26, 2015 (edited) Both Melba's and my solution use a 2Darray for the add array, specifying anything other in mine would cause bounds explosions. Edited September 26, 2015 by boththose ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
kcvinu Posted September 26, 2015 Author Share Posted September 26, 2015 @boththose , My goal is to make a function to add a 1D array to a 2D array. But melba and you tried to make 2D + 2D function. Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only) Link to comment Share on other sites More sharing options...
iamtheky Posted September 26, 2015 Share Posted September 26, 2015 (edited) mine had an error as well, $k was looping on the wrong ubound, i believe this fixes thatexpandcollapse popup#include <Array.au3> Local $aFirst = [[5, 6, 7, 1, 0], [8, 9, 10, 1, 0], [11, 14, 15, 1, 0], [16, 17, 18, 1, 0]] Local $aSecond = [[1, 3, 4, 4, 6]] $timer = timerinit() $aRowSmash = _2Dsmash($aFirst , $aSecond, 0) consolewrite(timerdiff($timer) & @CRLF) _ArrayDisplay($aRowSmash) Func _2Dsmash($aBase , $aAdd , $flag = 0) If $flag = 0 Then redim $aBase[ubound($aBase) + ubound($aAdd)][ubound($aBase, 2)] For $k = 0 to ubound($aAdd) - 1 For $i = 0 to ubound($aBase , 2) - 1 $aBase[ubound($aBase) - ubound($aAdd) + $k][$i] = $aAdd[$k][$i] Next Next Else redim $aBase[ubound($aBase)][ubound($aBase , 2) + ubound($aAdd , 2)] For $k = 0 to ubound($aAdd , 2) - 1 For $i = 0 to ubound($aBase) - 1 $aBase[$i][ubound($aBase , 2) - ubound($aAdd , 2) + $k] = $aAdd[$k][$i] Next Next EndIf return $aBase EndFunc ;2Dsmash Edited September 26, 2015 by boththose kcvinu 1 ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 26, 2015 Moderators Share Posted September 26, 2015 kcvinu,Then we just convert the array inside the function like this:expandcollapse popup#include <Array.au3> Global Enum $eAddRow, $eAddCol Global $aBase[3][3] = [["0-0", "0-1", "0-2"], _ ["1-0", "1-1", "1-2"], _ ["2-0", "2-1", "2-2"]] Global $aAdd[3] = ["A", "B", "C"] _ArrayDisplay($aBase, "", Default, 8) $aBaseArray = $aBase _ArrayAdd_Ex($aBaseArray, $aAdd) _ArrayDisplay($aBaseArray, "", Default, 8) $aBaseArray = $aBase _ArrayAdd_Ex($aBaseArray, $aAdd, $eAddCol) _ArrayDisplay($aBaseArray, "", Default, 8) Func _ArrayAdd_Ex(ByRef $aBaseArray, $aAdd, $iLocation = $eAddRow) Local $aAdd2D[1][UBound($aAdd)] For $i = 0 To UBound($aAdd) - 1 $aAdd2D[0][$i] = $aAdd[$i] Next If $iLocation = $eAddCol Then _ArrayTranspose($aBaseArray) _ArrayAdd($aBaseArray, $aAdd2D) If $iLocation = $eAddCol Then _ArrayTranspose($aBaseArray) EndFuncM23 kcvinu 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
kcvinu Posted September 26, 2015 Author Share Posted September 26, 2015 @Melba23 & @boththose Let me check both functions. Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only) Link to comment Share on other sites More sharing options...
kcvinu Posted September 26, 2015 Author Share Posted September 26, 2015 (edited) Ok. Testing is over. @boththose 's function agian gave error. But melba's function give these reults. See this ? 0.14 second for adding row and 0.25 second for adding column. But mine was resulted like this See this ? Both are around same time. 0.062 sec and 0.064 sec Edited September 26, 2015 by kcvinu Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now