I'm trying to use isnan to find if there is any NaNs in y in a window of 12 time points and if there are set all values for X in the window to NaN. but I'm running into some issues.
This is the code I've used
The part I believe is the issue is "if isnan(x(i:i+11,k))", because if I use if isnan(x(i,k)) it works but then it only sets X(i:i+11,k) to NaN if the i'th y is NaN (i.e it doesn't check the whole window)
Any ideas of what I could do?