Results 1 to 4 of 4
  1. #1
    mblem22 is offline Member
    Join Date
    Jun 2012
    Posts
    9
    Rep Power
    0

    Default 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 03:17 PM.

  2. #2
    mblem22 is offline Member
    Join Date
    Jun 2012
    Posts
    9
    Rep Power
    0

    Default 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. #3
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,435
    Blog Entries
    7
    Rep Power
    20

    Default 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
    cenosillicaphobia: the fear for an empty beer glass

  4. #4
    Diargg is offline Senior Member
    Join Date
    Feb 2012
    Posts
    117
    Rep Power
    0

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

    Quote Originally Posted by mblem22 View Post
    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.

Similar Threads

  1. How to convert array of Objects into array of Strings
    By elenora in forum Advanced Java
    Replies: 1
    Last Post: 06-10-2011, 03:48 PM
  2. Array of Objects
    By coopc in forum New To Java
    Replies: 3
    Last Post: 04-29-2011, 02:45 AM
  3. help with and array of objects
    By hoosierfan24 in forum New To Java
    Replies: 5
    Last Post: 01-23-2011, 02:45 AM
  4. Array of Objects
    By bluefloyd8 in forum New To Java
    Replies: 5
    Last Post: 01-22-2008, 06:27 PM
  5. Array with objects
    By toby in forum New To Java
    Replies: 1
    Last Post: 07-25-2007, 09:50 AM

Posting Permissions

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