I have a structured array (1x1) called 'Data' which has 3 fields. Each field contains a vector of data.
The following code is used to replace values which vary by greater than 0.2
with the value next to it with NaN
. However, is it possible to alter this code so that the value which alters by 0.2
does not change to NaN
but changes to the value which it was compared to?
for i=1:3;
I{i} = find(diff(Data.(Names{i}))>0.2);
Data.(Names{i})(I{i}+1)=NaN;
end
thanks