I have a vector, say v = [ 1 2 3 4 5 6 ....] '(adsbygoogle = window.adsbygoogle || []).push({});

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

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Grab elements from a vector thru formula, matlab

**Physics Forums | Science Articles, Homework Help, Discussion**