Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9254219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:24:45+00:00 2026-06-18T11:24:45+00:00

I have a 3d array with dimensions M x N x L, which defines

  • 0

I have a 3d array with dimensions M x N x L, which defines the values on a cyclical volume (i.e. the M-1’th point is next to the 0th point, if we’re zero indexing). If I’m given the coordinates of a point (X, Y, Z), how can I neatly find all the next door points (i.e. points which are one away in one dimension only)?

my initial solution was just to for loop over all values in the array (the array is fairly small) and then have something like:

if abs(X-M) + abs(Y-N) + abs(Z-L) == 1
  do neighboring point stuff
end

but this doesn’t take into account of the cyclic aspect. Thoughts on a quick, neat way to do this would be fab.

thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T11:24:46+00:00Added an answer on June 18, 2026 at 11:24 am

    this is what I’ve ended up doing for those interested (don’t know why I didn’t think of it sooner):

    for dimension=1:3
      for direction=-1:2:1
        vec = zeros(3,1);
        vec(dimension) = direction;
    
        this_point = point + vec;
        this_point(dimension) = mod(this_point(dimension)-1,size(obj.int_ref,dimension))+1;
      end
    end
    

    note that this is matlab code, and so the arrays’ indeces start at 1 (hence the unusual mod line).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this 4 Dimensional array to store String values which are used to
I have an Array which looks like this. [{title=>ga:browser=Internet Explorer, dimensions=>[{:browser=>Internet Explorer}], metrics=>[{:pageviews=>2047}], id=>http://www.google.com/analytics/feeds/data?ids=ga:12316&ga:browser=Internet%20Explorer&start-date=2010-02-27&end-date=2011-02-27,
I have an associative array. Two dimensions which I am iterating through like this
Lets say I have an array which has n dimensions. Now in order to
Suppose I have some pointer, which I want to reinterpret as static dimension array
I have a multi-dimensional array, which basically consists of one sub-array for each year.
i am using visual studio 2010. i have a three dimensional structure array which,
I have a 2-dimensional jagged array (though it's always rectangular), which I initialize using
I have a array of two dimensions object[,] data; . I want to convert
I’m working on a multi dimensions array but i have a problem Imagine I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.