help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 3 dimensional array


From: Nicholas Jankowski
Subject: Re: 3 dimensional array
Date: Mon, 6 Jul 2015 15:32:07 -0400

On Mon, Jul 6, 2015 at 11:24 AM, William Becerra <address@hidden> wrote:
Hello, I am new to Octave and programming.
I was reading on arrays and i came across 3D arrays and  I am confused by the way in which octave expresses the array
Here is an example 

octave:30> B(2,2,2)=1
B =
ans(:,:,1) =
0 0
0 0
ans(:,:,2) =
0 0
0 1

The 3D array is expressed as two 2D arrays and this is exactly what i find confusing. Is  B(2, 1, 1) = B(1, 1, 2) can someone please provide a short explanation to 3D arrays or refer me to some good documentation so i can understand it further. 

Thank you


they work like  Matlab multidimensional array objects.
http://www.mathworks.com/help/matlab/math/multidimensional-arrays.html

think of a 3-d array as multiple pages of 2d arrays or matrices. if I had five 2x2 matrices, I could store it as a 2x2x5 3D array. If it was named B, I would get the 1st row, 2nd column of the 4th 'page' by B(1,2,4).  the : is shorthand for 'all values'.  so (:,:,1) means all rows, all columns of the 1st third-dimensional page.

nickj

reply via email to

[Prev in Thread] Current Thread [Next in Thread]