MATLAB Answers

Using isnan to check if there is any NaNs in a window and setting all the values to NaN if there are any.

14 views (last 30 days)
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
for i=1:11:T;
for k=1:3;
if isnan(y(i:i+11,k));
X(i:i+11,k) =NaN;
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?

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!