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)
>
> > Appreciate your help.
> > 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 p1]
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
