Vector elements are indices of another vector Matlab
I have 1x10 vector A
A = [11 22 33 44 55 66 77 88 99 111]
Each value in A represents an index in vector B which is 1x200.
I want to get each value in vector A and go to the index of this value in
vector B and get the value of this index and the 10 items before and 10
items after.
For example, the first element in vector A is 11, so I'll go to index 11
in vector B and get the value of this index (11th value) and the value of
the 10 items before it (from 1 to 10) and 10 items after (from 12 to 21),
same for every element in A.
Is possible to do it without loops?
No comments:
Post a Comment