Can anyone suggest a way in which it is possible to perform operations on a vector according to a predetermined sequence - for example I have a vector of different values, M, which is <8760x1> in size. I have another vector with a sequence of numbers, P, (size <300x1>) and this sequence sums to 8760. I would like to use these P values to index the vector M and find the product of each index.
An example to make this clearer:
M = [1,2,4,2,3,4,5,3,4,2];
P = [2,2,4,2];
Result = [3,6,15,6]
Any help here would be greatly appreciated.
Peter.S.