filling missing value using linear interpolate in 2D
5 次查看(过去 30 天)
显示 更早的评论
From the attached file, i used FUni=fillingmissing2(filename,''linear'') to fill the missing numbers from my data, is this the correct code but i am not quite sure about it, i just need confirmation before i go further
回答(1 个)
Star Strider
2023-10-17
This works —
T1 = readtable('GreenhouseData.xlsx', 'VariableNamingRule','preserve')
VN = T1.Properties.VariableNames;
T1(:,[2 3]) = fillmissing(T1(:,[2 3]),'constant','NaN');
T2 = fillmissing(varfun(@str2double,T1, 'InputVariables',[2 3]), 'linear');
T2 = addvars(T2, T1{:,1}, 'Before',1);
T2.Properties.VariableNames = VN
figure
plot(T2.Time, T2{:,[2 3]})
grid
xlabel(VN{1})
ylabel('Value')
legend(VN{[2 3]}, 'Location','NW')
It should be easier to use varfun for these conversions. It should not require creating a separate table.
.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
