Compare Two Data Sets: How to Compare Only the non-NaN rows Together?
조회 수: 3 (최근 30일)
이전 댓글 표시
Hello all,
I have a general question. if I have 2 data sets of real data and predicted data, which in those column A is date and column B is value, is it possible to compare them when I have some NaN values in real data set?
I thought it would be easy by index using isnan but if I ignore NaN rows in reading data sets how to recognize related date value from predicted data sets? in fact, I want to compare only the non-NaN rows together.
댓글 수: 0
답변 (1개)
Jakob B. Nielsen
2019년 12월 19일
Question one: how can you have predicted data, if you have no real data? :D
Anyways. Does your predicted data for those instances where you have no real data matter? I would simply remove them from the data set before comparing... (Of course, save the whole thing separately before deleting entries in a 'work file'...)
Otherwise, you can totally do what you want with isnan function. Just keep all your data in the same matlab table in the workspace, and then if there is a NaN value in column 4, skip for that index.
rows=size(Data,1);
for i=1:rows
if isnan(Data(i,4))
%do nothing
else
%do your comparison
end
end
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!