I have a vector, say v = [ 1 2 3 4 5 6 ....] '

and suppose that I want to first take the first n elements and place them somewhere else, then the next n-1 elements and place them somewhere else, and so on....

How would I do the indexing if it were performed in a loop?

So for example, if v = [ 1 2 3 4 5 6 ] '

then I could do

a = v(1:3,:)

b = v(4:5,:)

c = v(6:6,:) = v(6,:)

I think that I might need two index values and that they may have to be equated somehow.... not sure, any ideas appreciated.

essentially I'm looking for a formula for v(i,j)

Thanks

and suppose that I want to first take the first n elements and place them somewhere else, then the next n-1 elements and place them somewhere else, and so on....

How would I do the indexing if it were performed in a loop?

So for example, if v = [ 1 2 3 4 5 6 ] '

then I could do

a = v(1:3,:)

b = v(4:5,:)

c = v(6:6,:) = v(6,:)

I think that I might need two index values and that they may have to be equated somehow.... not sure, any ideas appreciated.

essentially I'm looking for a formula for v(i,j)

Thanks

Last edited: