Reputation: 347
In MATLAB I have extracted a vector of indices corresponding to non-zero values. My vector - we can call idx - is of type double and of size 5x1 (for example) and looks something like this:
33 71 81 120 132
I have also made an empty vector of type double and of size length(idx)*4 so, in this example it is of size 20x1 and it is filled with zeros.
What I would like to do is increment every value in 'idx' by 1, 2, and 3 and add those numbers to the empty array after the idx value. So for example the new array would look like:
33 34 35 36 71 72 73 74 etc...
Is there a way to do this? Thank anyone for their help.
Upvotes: 0
Views: 40