MATLAB Answers

Fill missing cells NANs

5 views (last 30 days)
Sarah Yun
Sarah Yun on 28 Dec 2019
Answered: Cris LaPierre on 31 Jan 2020
Hi,
I imported data from textfile using data editor.
Some cells are <missing data>
This is string data.
All cells must be numerical or NAN
How can I fill the missing data cells with NAN?

  0 Comments

Sign in to comment.

Answers (1)

Cris LaPierre
Cris LaPierre on 31 Jan 2020
<missing> is the appropriate value for missing string data. From the doc:
Standard missing values depend on the data type:
  • NaN for double, single, duration, and calendarDuration
  • NaT for datetime
  • <missing> for string
  • <undefined> for categorical
  • ' ' for char
  • {''} for cell of character arrays
If you need NaN, read in your data as numbers instead of strings.

  0 Comments

Sign in to comment.

Sign in to answer this question.

Tags


Translated by