Jump to content
Sign in to follow this  

Recommended Posts

According to the help file, you cannot resize the dimensions of an existing array and retain the data in it.  Per the help file, 

Quote

The ReDim keyword is similar to Global/Local, except that ReDim preserves the values in the array instead of removing the values while resizing an array.
The number of dimensions must remain the same, or the old array will be forgotten during the ReDim.
The array will retain the scope (Global or Local) that it had prior to resizing.

So you'll probably have to create a new 3D array and populate as needed, or re-write your script to make the array 3D from the get go.


Share this post


Link to post
Share on other sites
4 hours ago, vrsrinivas2000 said:

2) How to change the 2d to 3d array (Already used 2d array in the scrip)

You can do this using _PreDim() without any data loss. The function was designed for this very purpose. See ArrayWorkshop in my signature below.

#include <ArrayWorkshop.au3>

Local $aArrayXD = [[1,2],[3,4]] ; 2D array
_PreDim($aArrayXD, 3) ; becomes a 3D array

After this you can increase the size of the third dimension using (the more standard) ReDim.

Alternatively, you can attach 2D arrays in the 3rd dimension using _ArrayAttach(): think of this as stacking spread sheets in a pile.

Edited by czardas

Share this post


Link to post
Share on other sites

Moved to the appropriate forum, as the DEV forum specifically states:

Quote

Do not create AutoIt-related topics here

 


"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Share this post


Link to post
Share on other sites
28 minutes ago, czardas said:

Yeah, I wondered about that. It shows how little I use Excel. It should have 3D grids though, and you should be able to zoom into the matrix using the mouse wheel. :D

Beam me up, Scotty!


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

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...