filmov
tv
Data Preprocessing in MATLAB | Machine Learning Part 2

Показать описание
Code used:
clc
e=Lefta.SalesRating;
count=0;
total=0;
for i=1:length(e)
if(~isnan(e(i)))
total=total+e(i);
count=count+1;
end
end
meanvalue=total/count;
es=[];
for i=1:length(e)
if(isnan(e(i)))
es=[es meanvalue];
else
es=[es e(i)];
end
end
Check this link , if you want to learn more on fillmissing in MATLAB:
Check this link , if you want to learn more on omitnan in MATLAB:
clc
e=Lefta.SalesRating;
count=0;
total=0;
for i=1:length(e)
if(~isnan(e(i)))
total=total+e(i);
count=count+1;
end
end
meanvalue=total/count;
es=[];
for i=1:length(e)
if(isnan(e(i)))
es=[es meanvalue];
else
es=[es e(i)];
end
end
Check this link , if you want to learn more on fillmissing in MATLAB:
Check this link , if you want to learn more on omitnan in MATLAB: