I am plotting data from 2 vectors, the x-axis elements (in a vector called M) needs to be flipped and make the first element 0, the last few elements in M recur like this [1 2 3...500 500 500 500...] and these recurring elements should discarded so it should be [...500 500 500 500 499 498... 3 2 0]
The method I went with is flipping each element by creating a new vector (called N) and using a for loop to switch the order. This however changes the size of my array because it ignores the recurring elements. I want to know how to fix this issue.
My code is
The 600x1 M array, becomes a 500x1 N array
*The array M changes because it nested in another loop so I can't use the line for k=1:500
**and I can't use the line for k=1:length(M)-1, because I get the error - Subscript indices must either be real positive integers or logicals.
(Because max(M) = 500 and the length = 600 and N(-100) is not allowed