I want to only look at a subset of the data starting from the 5th index +/-2 of data:
window = data(5-2:5+2)
4 5 3 2 4
That works no problem because the data exisit.
Now say I want to look a the data starting from the 5th index -10/+2
window = data(5-10:5+2)
window = 'Array indices must be positive integers or logical values.'
Since there are not 10 indices available before the 5th index this won't work.
Is there a way to automatically fill indexes that don't exist with 'NaN' and fill the rest do the final output would look something like:
NaN NaN NaN NaN NaN NaN 2 3 4 5 3 2 4
Any help would be greatly appreciated.