Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


Math Forum » Discussions » Software » comp.soft-sys.matlab

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

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
rajkrai@gmail.com

Posts: 8
Registered: 1/18/08
Re: constructing indices
Posted: Oct 23, 2011 1:32 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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 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





Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.