temp = X;temp(~isnan(temp)) = 1;temp(isnan(temp)) = 0;temp = find(temp);first_non_NaN_index_of_X = temp(1);
MATLAB: Is there a simpler way to find the index of the first non NaN value in a vector
findnanvector
findnanvector
temp = X;temp(~isnan(temp)) = 1;temp(isnan(temp)) = 0;temp = find(temp);first_non_NaN_index_of_X = temp(1);
Best Answer