Sign in to follow this  
Followers 0
Myicq

Update wiki example for 2d arrays - suggestion

13 posts in this topic

I had a need today to make 2d arrays. Could not remember how, so on to the Wiki.

It's all nicely explained, BUT unfortunately I was in doubt which parameter is rows, which is columns.

The Wiki shows example of [3][3], which does not explain much. Nothing is mentioned about the order.

May I suggest to update Wiki to show example for something like [3][5] and clearly indicate which of 3 is rows, which is columns ?

Just a suggestion, really :)

Thanks


I am just a hobby programmer, and nothing great to publish right now.

Share this post


Link to post
Share on other sites



The standard convention is rows then columns, but it doesn't really matter.  As long as your script is consistant in the way it uses the array, you can order them either way.

Share this post


Link to post
Share on other sites

All users have access to edit the wiki. So there was no need to request.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

*Scratches head*. ... http://www.mediawiki.org/wiki/Help:Tables

Oops. Brain lock on wrong language.

Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I think the concept of arrays is perfectly described in the help file.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

What about the last line in the link above: "The use of an Array inside another Array can affect the execution speed of your script." Is this correct? I don't think so.

Share this post


Link to post
Share on other sites

Why do you think it doesn't?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

In the three examples below there are three arrays with an integer, a string, and an array (an array inside another array). In the loops a variable is assigned the content of the integer, string and array.

Example1 is the fastest and Example3 is the slowest. But the time increase from Example2 (string) to Example3 (array) is not much bigger than the time increase from Example1 (integer) to Example2 (string).

Conclusion: The time increase for using an array inside an array is not significant, compared to using other data types (strings, floats) inside an array.

 

Example1()
Example2()
Example3()

Func Example1()
  Local $v, $i = 3, $a1[4] = [ 1, 2, $i, 4 ]
  Local $hTimer = TimerInit()
  For $i = 1 To 100000
    $v = $a1[2] ; $v = $i
  Next
  ConsoleWrite( "Time (integer) = " & TimerDiff( $hTimer ) & @CRLF )
EndFunc

Func Example2()
  Local $v, $s = "This is a string", $a1[4] = [ 1, 2, $s, 4 ]
  Local $hTimer = TimerInit()
  For $i = 1 To 100000
    $v = $a1[2] ; $v = $s
  Next
  ConsoleWrite( "Time (string) = " & TimerDiff( $hTimer ) & @CRLF )
EndFunc

Func Example3()
  Local $v, $a2[4] = [ 1, 2, 3, 4 ], $a1[4] = [ 1, 2, $a2, 4 ]
  Local $hTimer = TimerInit()
  For $i = 1 To 100000
    $v = $a1[2] ; $v = $a2
  Next
  ConsoleWrite( "Time (array) = " & TimerDiff( $hTimer ) & @CRLF )
EndFunc

Share this post


Link to post
Share on other sites

LarsJ,

I get these results (Win7 x64)...

Time (integer) = 53.3489817378393
Time (string)  = 69.3359536534167
Time (array)   = 89.7996557876123


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

Ditto on 8.1 x64. Difference is not huge for this example, but enough that I think the statement is valid.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

I just think it's a pity that a lot of AutoIt users avoid to use this nice feature (arrays inside an array) because of this warning. They think the loops to handle the arrays will be running for 20 seconds more. The fact is that they probably only will be running for 20 milli seconds more.

I've used this feature a lot (since version 3.6). I've never experienced performance issues. When I have performance issues with arrays, it's nearly always caused by the ReDim statement.

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

LarsJ,

I will amend the Help file text to reflect the current situation reflected by the results posted above - which match my own tests. :)

M23

Edit: "An array stored inside another array can be accessed directly, but this method is slightly slower than accessing other datatypes:"

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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