04-08-2011 08:07 PM
I have an array of size Nx1 and I would like to return a subset of size Mx1 but Mx1 is not a contiguous subarray of the original set. Is there a way to do this without looping through my set of M and plucking out the points one by one?
Thanks!
Steven
04-08-2011 10:06 PM
What is it about the elements that makes them a set of the array Mx1? Maybe if I know that I can suggest a method to do what you want without looping through and picking points one by one.
04-08-2011 10:13 PM
So I have a vector X(N) and I want to multiply say every other element [e.g. X(1,3,5,7,9,...,N) ] by another vector which I obtain in a similar fashion.
In MATLAB, my code would look something like this.
index1 = [1:K:N];
index2 = [1:L:M];
X(index1)*X(index2);
where index1 and index 2 are of the same total length but just represent different indices within X.
Thanks very much!
04-09-2011 12:50 AM
What is wrong with looping?
If the indices are every other one like you have shown, then you could use decimate array.