Sign in to follow this  
Followers 0
beestinga

Splitting up multidimensional arrays

9 posts in this topic

Hey,

I've got a 3 dimensional array (3x5x5), and I can't really do anything with it as it is (arraydisplay only likes 2d arrays, the excelcom arraytosheet udf also only works with 2d arrays), and I was wondering if such a piece of code has been written to split a 3x5x5 array into 3 5x5 arrays, or something like that. I've searched around without any luck, and such autoit mysticism is beyond my grasp.

Thanks,

Jason

Share this post


Link to post
Share on other sites



Hey,

I've got a 3 dimensional array (3x5x5), and I can't really do anything with it as it is (arraydisplay only likes 2d arrays, the excelcom arraytosheet udf also only works with 2d arrays), and I was wondering if such a piece of code has been written to split a 3x5x5 array into 3 5x5 arrays, or something like that. I've searched around without any luck, and such autoit mysticism is beyond my grasp.

Thanks,

Jason

The question here is why do you have a 3D array in the first place? Why not 2D, or 4D?

This array came from somewhere and had some purpose when the designer decided to declare it as 3D. What were the requirements that lead to it being a 3D array in the first place? What was the purpose?

Simple For/Next loops can extract 2D data from a 3D array, but which dimensions? That depends on what the data means and what the query (2D extraction) means.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

...

Last Seen: Today, 12:55 PM Local Time: Sep 18 2008, 03:58 PM

************************************************

Gotta love this kind of person, asks a question and just disappears. This kind of person just wants to return and find the code written for him/her

:)

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Last Seen: Today, 12:55 PM Local Time: Sep 18 2008, 03:58 PM

************************************************

Gotta love this kind of person, asks a question and just disappears. This kind of person just wants to return and find the code written for him/her

:)

8)

hey asshole, sorry i wasn't in here in the 15 minutes between when i got a response and you spotted the thread.

you really have nothing better to do with your time?

seriously, get a life.

Have you looked at my posting history. I'm not any sort of uber-1337 programmer, but when I whip something together, I post it in the examples forum.

I'm sorry. I know you're just a troll and trolls don't deserve acknowledgment, but...well...today's been kind of a pain.

Anyway, psalty, to answer your question:

I created the array. I'm working with a series of datasets. Basically, 3 5x5 tables, and I need to reference one cell at a time out of the three tables, so i punched the tables in manually into a 3x5x5 array and now I need to output the tables to something like a spreadsheet (which I can do with excelcom when I have 2d arrays.

Share this post


Link to post
Share on other sites

Don't over react. I'm not sure why Valuater jumped on that, but he is a long time and valuable contributor to this forum, not a troll. He has answered a lot of my questions and people like him are why I lurk on this forum.

Anyway, psalty, to answer your question:

I created the array. I'm working with a series of datasets. Basically, 3 5x5 tables, and I need to reference one cell at a time out of the three tables, so i punched the tables in manually into a 3x5x5 array and now I need to output the tables to somehing like a spreadsheet (which I can do with excelcom when I have 2d arrays.

Just run nested For/Next loops to copy the data to a temporary 2D array. Take a shot at coding it and post what you got if you get stuck.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

I already had this question.

Here you got the fish:

Local $TempArray[UBound($Glob_Current_Troops_IN, 2)][UBound($Glob_Current_Troops_IN, 3)];Create a 2D Table with the information of a 3d table
                For $x = 0 To UBound($TempArray, 1) - 1
                    For $i = 0 To UBound($TempArray, 2) - 1
                        $TempArray[$x][$i] = $Glob_Current_Troops_IN[$CT][$x][$i]
                    Next
                Next
                _ArrayDisplay($TempArray)

Swap $Glob_Current_Troops_In for your 3D array.


You can help! Donate to AutoIt! or, visit ClimatePREDICTION.netMy posts:Travian Bot Example (100+ servers) BETAHow to Host you code/app for free! (unlimited team number) (Public or Private)"Sir, we're surrounded!" "Excellent. We can attack in any direction!"

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Hey,

thank you guys for your help. I may have been able to hack something together in many hours, but I wasn't familiar with the UBound (command? macro? what is that thing?)

Anyway. I'll take a look at this and maybe make a user-friendlier UDF out of it.

Thanks,

Jason

To make the above code work, would I need to define $CT as a counter, maybe do:

Local $TempArray[UBound($Glob_Current_Troops_IN, 2)][UBound($Glob_Current_Troops_IN, 3)];Create a 2D Table with the information of a 3d table
                For $x = 0 To UBound($TempArray, 1) - 1
                 $CT=0
                    For $i = 0 To UBound($TempArray, 2) - 1
                        $TempArray[$x][$i] = $Glob_Current_Troops_IN[$CT][$x][$i]
                    Next
                 $CT+=1
                Next
                _ArrayDisplay($TempArray)

??

Edited by beestinga

Share this post


Link to post
Share on other sites

UBound is a function. It's in the help file under Function Reference\Variables and Conversions.

Share this post


Link to post
Share on other sites

Hey,

thank you guys for your help. I may have been able to hack something together in many hours, but I wasn't familiar with the UBound (command? macro? what is that thing?)

Anyway. I'll take a look at this and maybe make a user-friendlier UDF out of it.

Thanks,

Jason

To make the above code work, would I need to define $CT as a counter, maybe do:

Local $TempArray[UBound($Glob_Current_Troops_IN, 2)][UBound($Glob_Current_Troops_IN, 3)];Create a 2D Table with the information of a 3d table
                For $x = 0 To UBound($TempArray, 1) - 1
                 $CT=0
                    For $i = 0 To UBound($TempArray, 2) - 1
                        $TempArray[$x][$i] = $Glob_Current_Troops_IN[$CT][$x][$i]
                    Next
                 $CT+=1
                Next
                _ArrayDisplay($TempArray)oÝ÷ Ûú®¢×z÷«)Ý"
-×âêÞvz-¶­¶«{¬ç!~(.®)à¶hjÂ0jÊkzÛrç!©ÝyÛayÊzÚ²)ozºejÛ^­»­~éy¦ëj)ì)à'˲"H§vëz¨v+-çèZ0xV®¶­sdgVæ2ôw&%F&ÆRb33c¶ô'&Âb33c¶ôFÖVç6öâ¤Æö6Âb33cµFV×'&µT&÷VæBb33c¶ô'&Â"ÕµT&÷VæBb33c¶ô'&Â2Фf÷"b33c·ÒFòT&÷VæBb33cµFV×'&ÂÒ f÷"b33c¶ÒFòT&÷VæBb33cµFV×'&Â"Ò b33cµFV×'&²b33c·Õ²b33c¶ÒÒb33c¶ô'&²b33c¶ôFÖVç6öåÕ²b33c·Õ²b33c¶Ð æW@¤æW@¥&WGW&âb33cµFV×'&¤VæDgVæ

Pretty bare-bones stuff. Just tell it which 3-d array you want to grab a table from, and which 2D array you want, and it'll output it.

Also cross-posting in example scripts. Thanks for the help y'all.

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