filling missing values with NA

3 ビュー (過去 30 日間)
Rae Taylor-Burns
Rae Taylor-Burns 2020 年 2 月 6 日
回答済み: Rae Taylor-Burns 2020 年 2 月 6 日
Hey all,
I am trying to compare model output to observations, but some observations are missing, and I need to fill them with NAs in order to make plots.
My observations are in a struct. See the attached photos for a visual of what I'm working with.
Annotation 2020-02-06 11082.jpg
Annotation 2020-02-06 110823.jpg
I have tried a couple ways to fill missing values with NAs, but nothing has been successful so far - this is what I have tried:
for ii = 1:length(runs_wanted)
for jj = 1:length(results(ii).point)
missing = ismissing(observations(ii).point(jj).Hs_select)
observations(ii).point(jj).Hs_select(missing) = NaN
end
end
and
for ii = 1:length(runs_wanted)
for jj = 1:length(results(ii).point)
if observations(ii).point(jj).Hs_select == ' '
observations(ii).point(jj).Hs_select == Nan
end
end
end
If anyone could help me figure this out I'd really appreciate it!
Thanks all,
Rae

採用された回答

Rae Taylor-Burns
Rae Taylor-Burns 2020 年 2 月 6 日
Hello!
I have figured out the answer to my own problem - I pre-allocated all my observations as NaN, and then filled in with numbers after. Hope this helps anyone who has a similar issue!
Rae

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by