フィルターのクリア

How do I replace missing data with other values?

2 ビュー (過去 30 日間)
Robert Earles
Robert Earles 2019 年 4 月 15 日
コメント済み: Robert Earles 2019 年 4 月 15 日
Hi guys,
I have some radiation data taken every 30 mins I’m trying to use, the dataset occasionally has some missing values, labelled ‘NaN’.
I have a series of equations which can be used to estimate the radiation (won’t mention them here as they’re not relevant to the problem) in case of missing collected data. I want to use the estimated values to replace any ‘NaN’ encountered.
My raw radiation data is called ‘radi’.
My code so far is:
if isempty(radi)
% LONG SERIES OF EQUATIONS
Rn=%some terms classified in equations;
else
Rn=radi;
end
This hasn’t worked however and Rn values are just being taken as radi values, and when radi shows ‘NaN’, Rn just comes out with no value on a graph, instead of taking the estimated Rn I want it to take.
I have tried isnan instead of isempty and this creates a new issue to do with vector sizes.
Long story short, is there a better method to replace my missing data (NaN) with the equations so that my radiation data set is full?
Thanks, Rob

採用された回答

Catalytic
Catalytic 2019 年 4 月 15 日
編集済み: Catalytic 2019 年 4 月 15 日
isnan is the correct way to detect and replace nans.
Rn=radi;
Rn(isnan(radi))= ---- something else ----
  1 件のコメント
Robert Earles
Robert Earles 2019 年 4 月 15 日
Will give this a go, thank you!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNumeric Types についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by