standardizeMissing not converting selected values to NaN

1 回表示 (過去 30 日間)
Christopher Traft
Christopher Traft 2024 年 4 月 3 日
コメント済み: Taylor 2024 年 4 月 4 日
I'm having trouble getting standardizeMissing to perform its function. I have a 3x4209 array of int32 values called bl_height. Some of the values are -999. I'm trying to change the -999 values to NaN using standardizeMissing, but the -999 values are retained. Can someone tell me what I'm doing wrong? I've tried pretty much every iteration of standardizeMissing possible. Here's my code below:
bl_height=ncread(filename,'bl_height');
bl_height_edited = standardizeMissing(bl_height,-999);

採用された回答

Taylor
Taylor 2024 年 4 月 4 日
It's because your values are integers not doubles. There is no room for a NaN value when using integers. The documentation for the input data to standardizeMissing specifies that the input should be one of the following data types: double | single | char | string | cell | table | timetable | categorical | datetime | duration
  2 件のコメント
Christopher Traft
Christopher Traft 2024 年 4 月 4 日
Thanks, it worked after I converted the values to doubles. Changed my first line to:
bl_height = double(ncread(filename,'bl_height'));
Taylor
Taylor 2024 年 4 月 4 日
Great! Just be aware that if you try to convert back to integers the NaN values will become 0s.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by