Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: constructing indices
Replies: 3   Last Post: Oct 23, 2011 2:39 PM

 Messages: [ Previous | Next ]
 rajkrai@gmail.com Posts: 13 Registered: 1/18/08
Re: constructing indices
Posted: Oct 23, 2011 1:32 PM

On Oct 23, 11:16 am, "Nasser M. Abbasi" <n...@12000.org> wrote:
> On 10/23/2011 11:44 AM, raj wrote:
>
>
>
>
>
>
>
>
>

> > Hello all,
> > To the following indices order, how the third indices work?

>
> > (1, 1, 1)
> > (2, 1, 1)
> > (3, 1, 2)
> > (1, 2, 2)
> > (2, 2, 3)
> > (3, 2, 3)
> > (1, 3, 4)
> > (2, 3, 4)
> > (3, 3, 5)
> > (1, 4, 5)
> > (2, 4, 6)
> > (3, 4, 6)
> > (1, 5, 7)
> > (2, 5, 7)
> > (3, 5, 8)
> > (1, 6, 8)
> > (2, 6, 9)
> > (3, 6, 9)

>
> > R
> > ......

>
> Not sure what you mean by " how the third indices work?".
>
> Work in what sense?
>
> I think of a 3D matix as a book.
> 2D matrix as page in the book.
> and 1D matrix as a row or a column on page.
>
> So, (3, 1, 2) means the third line, in the first column on the second page of the book.
> and (3, 6, 9) means the third line, in the 6th column on the 9th page of the book.
>
> and so on
>
> --Nasser

Thanks Nasser.
I have the code:
p = 0;
for j = 1:3;
for i = 1:3;
p = p+1;
if (mod(p,2)==1)
[i j p]
else
[i j p-1]
end
end
end

It produces
(1, 1, 1)
(2, 1, 1)
(3, 1, 3)
(1, 2, 3)
(2, 2, 5)
(3, 2, 5) and so on.

But I want to get the following.
(1, 1, 1)
(2, 1, 1)
(3, 1, 2)
(1, 2, 2)
(2, 2, 3)
(3, 2, 3) and so on.

Thanks,
R

Date Subject Author
10/23/11 rajkrai@gmail.com
10/23/11 Nasser Abbasi
10/23/11 rajkrai@gmail.com
10/23/11 Roger Stafford