# Thread: 1D Sub-Array From 3D Array of Objects

1. Member
Join Date
Jun 2012
Posts
9
Rep Power
0

## 1D Sub-Array From 3D Array of Objects

Edit: title should be ... Array of Doubles, not objects

Hello -

Wondering how I can get a reference to a 1D array which is part of a 3D array of doubles, so that I can pass it to a method. What I mean is basically this:

double myDouble = myFunction(myArray[i][ALL][j]);

where myFunction takes a 1D array of doubles as an argument. If you are familiar with MATLAB, I basically want the java equivalent of myArray(i)(:)(j).

Is there a built in method somewhere for doing this? Or do I need to make a new array? I would hate to pointlessly use more memory.

Sorry if this is not clear (very tired...). I'd be happy to clarify. Thanks for any help. This one has me quite stumped.
Last edited by mblem22; 07-05-2012 at 04:17 PM.

2. Member
Join Date
Jun 2012
Posts
9
Rep Power
0

## Re: 1D Sub-Array From 3D Array of Objects

I have also posted this thread at 1D Sub-Array From 3D Array of Doubles

3. ## Re: 1D Sub-Array From 3D Array of Objects

A two dimensional array is an array of rows; so if your array is named 'a', the a[0] is a one dimensional array and it has the elements of the first row; same with a[1], a[2] etc. You can't do the same with the columns of the two dimensional array (matrix) a.

kind regards,

Jos

4. Senior Member
Join Date
Feb 2012
Posts
117
Rep Power
0

## Re: 1D Sub-Array From 3D Array of Objects

Originally Posted by mblem22
I would hate to pointlessly use more memory.
Does your computer charge you by the bit? If so, you can have some of mine. If this were C++ you could probably do some pointer arithmetic, but here you're stuck with looping over it.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•