Only Changing NaN values of a vector
Show older comments
I want to access (202 elements) from vec A and check if isnan and change these but keep my normal values. Code to change all elements;
A = smooth(A, 'lowess'); %I want to change only NaNs
keepInA = zeros(size(all_behav(:,1))); %created new vec
for i = 1:size(A) %search 202 rows
mem = i(:,1) == isnan; %try find isnan ---- not working (showing 202 0s)
end
I haven't made much progress, pretty bad at loops any help appreciated
Accepted Answer
More Answers (1)
Walter Roberson
on 2 Apr 2018
A( isnan(A) ) = 0; %if you are changing them to 0.
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!