Welcome to the Excel Forum

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.

Please Register to Remove these Ads

Please Register to Remove these Ads



Reply
  #1  
Old 06-19-2005, 01:08 PM
Tornados Tornados is offline
Registered User
 
Join Date: 23 Dec 2003
Posts: 3
Tornados is becoming part of the community
Three Dimensional Array Question

Please Register to Remove these Ads

Advice on three dimensional array (difficult?)
(posted earlier in programming .. no reply yet)
--------------------------------------------------------------------------------

Hello, with two dimensions i seem to be able to do everything i want.. yet when they become three, things get more complicated. Please adivce on the following matters:

I have an array that contains two kinds of values , these values occur often and for each row i want the third dimension to act...so:

array(0 to 999, 0 to 1, 0 to 10) ' for example 11 rows, 1000 hits and 2 fields

then everytime something changes in column A from one of the 10 rows i want to add this number to the array in the right dimension and accordingly show the average of all values that have changed in the column A of the specific row.

1st i would like to know what the memory wise best way is to do this... it could be that there are 10 changes in row 1 (dimension 1) and 4 changes in row 2 (dimension 2).. How do i find the no of entries in the dimensions? if i understand correctly all dimension will have the same amount of elements .. so how do i get a correct average of these? I made it to work with two dimensions and to check which row it is yet i want it in 3 dimensions.


ie:
For x = 0 To ubound(array,1)
SUM = SUM + array(x, 2, row)
Next x
' will it be best then to check everytime whether an element has a value and then only add it?

2nd is it best to reserve memory in advance for an estimated amount of hits (999) in the example or make a dynamic one and redim each time an update occurs.

3rd and finally, is it only possible to refer to a dimension with a number or can it be text.. if for example i want to convert a text to a number can the array handle for example dimension 1500 when the rest is empty?

Tx! tornado
Reply With Quote
  #2  
Old 06-19-2005, 08:05 PM
Gary's Student
Guest
 
Posts: n/a
RE: Three Dimensional Array Question

These are only general comments, PCs vary with regard to both available
memory and processor speed:

1. Checking for zero in the x-loop will both add code and possibly slow the
code.
2. The same is true for dynamic allocation of memory. If your computer has
the memory, then allocate the array and don't redim.
3. I haven't gotten an array to index from a string variable, but it may
still be possible.
--
Gary's Student


"Tornados" wrote:

>
> Advice on three dimensional array (difficult?)
> (posted earlier in programming .. no reply yet)
> --------------------------------------------------------------------------------
>
> Hello, with two dimensions i seem to be able to do everything i want..
> yet when they become three, things get more complicated. Please adivce
> on the following matters:
>
> I have an array that contains two kinds of values , these values occur
> often and for each row i want the third dimension to act...so:
>
> array(0 to 999, 0 to 1, 0 to 10) ' for example 11 rows, 1000 hits and 2
> fields
>
> then everytime something changes in column A from one of the 10 rows i
> want to add this number to the array in the right dimension and
> accordingly show the average of all values that have changed in the
> column A of the specific row.
>
> 1st i would like to know what the memory wise best way is to do this...
> it could be that there are 10 changes in row 1 (dimension 1) and 4
> changes in row 2 (dimension 2).. How do i find the no of entries in the
> dimensions? if i understand correctly all dimension will have the same
> amount of elements .. so how do i get a correct average of these? I
> made it to work with two dimensions and to check which row it is yet i
> want it in 3 dimensions.
>
>
> ie:
> For x = 0 To ubound(array,1)
> SUM = SUM + array(x, 2, row)
> Next x
> ' will it be best then to check everytime whether an element has a
> value and then only add it?
>
> 2nd is it best to reserve memory in advance for an estimated amount of
> hits (999) in the example or make a dynamic one and redim each time an
> update occurs.
>
> 3rd and finally, is it only possible to refer to a dimension with a
> number or can it be text.. if for example i want to convert a text to a
> number can the array handle for example dimension 1500 when the rest is
> empty?
>
> Tx! tornado
>
>
> --
> Tornados
> ------------------------------------------------------------------------
> Tornados's Profile: http://www.excelforum.com/member.php...fo&userid=4178
> View this thread: http://www.excelforum.com/showthread...hreadid=380406
>
>

Reply With Quote


Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Forum Jump