# Multidimensional Arrays

Page 1 of 1

## 2 Replies - 2382 Views - Last Post: 28 November 2009 - 06:57 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=141316&amp;s=b63dfe8903e5d21d94acb8c0bf36c469&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 ell

Reputation: 0
• Posts: 22
• Joined: 06-August 09

# Multidimensional Arrays

Posted 24 November 2009 - 01:28 PM

Hi all, I am struggling with multidimensional arrays, I need a method that can produce an array that acceps an array of dimension sizes e.g.

```MultiArray.new([40, 45, 3])
```

Would produce an array with 40 width, 45 height and 3 layers. I know this is alot to ask and I'm sorry if i'm not in the right spirit of ishow some work and we will help and point you out but I am frustrated at only being able to create 2d arrays and quite strenously! thanks in advance, ell.

Is This A Good Question/Topic? 0

## Replies To: Multidimensional Arrays

### #2 EdwinNameless

Reputation: 128
• Posts: 723
• Joined: 15-October 09

## Re: Multidimensional Arrays

Posted 24 November 2009 - 03:25 PM

ell, on 24 Nov, 2009 - 12:28 PM, said:

Hi all, I am struggling with multidimensional arrays, I need a method that can produce an array that acceps an array of dimension sizes e.g.

```MultiArray.new([40, 45, 3])
```

Would produce an array with 40 width, 45 height and 3 layers. I know this is alot to ask and I'm sorry if i'm not in the right spirit of ishow some work and we will help and point you out but I am frustrated at only being able to create 2d arrays and quite strenously! thanks in advance, ell.

There are several ways of doing. First, the "simple" way (I can't say I would have come up with it myself). Then, there are libraries providing multidimensional arrays, like narray.

(had you wanted 2 dimensional arrays, you could have also used matrices which are at first a bit tricky to use, and then prove very useful).

This post has been edited by EdwinNameless: 24 November 2009 - 03:25 PM

### #3 ell

Reputation: 0
• Posts: 22
• Joined: 06-August 09

## Re: Multidimensional Arrays

Posted 28 November 2009 - 06:57 AM

Wow, thanks a bundle, works a treat!