How transform all ‘NaN’ string in double NaN for each rows

3 visualizaciones (últimos 30 días)
gcicceri
gcicceri el 10 de Sept. de 2020
Comentada: Ameer Hamza el 10 de Sept. de 2020
Hi guys,
I have this table:
Date A B C D
'03-Jan-2005' 'NaN' 583 'NaN' 217
'04-Jan-2005' 872 586 'NaN' 219
'05-Jan-2005' 873 578 'NaN' 221
'06-Jan-2005' 888 572 'NaN' 222
'07-Jan-2005' 881 'NaN' 'NaN' 223
'10-Jan-2005' 879 564 'NaN' 222
My question is:
how to transform all 'NaN' value that I find in my table rows in a numeric(double) format?
Thank you very much for your answers.

Respuestas (2)

KSSV
KSSV el 10 de Sept. de 2020
Let T be your table.
T.C = str2double(T.C) ;
  1 comentario
gcicceri
gcicceri el 10 de Sept. de 2020
Thanks for the answer, but mine is just an example and my request is in case the 'NaN' values appear in several rows and columns.

Iniciar sesión para comentar.


Ameer Hamza
Ameer Hamza el 10 de Sept. de 2020
  2 comentarios
gcicceri
gcicceri el 10 de Sept. de 2020
Thanks for the answer, but mine is just an example and my request is in case the 'NaN' values appear in several rows and columns.
Ameer Hamza
Ameer Hamza el 10 de Sept. de 2020
Can you attach the actual table in a .mat file? In your question, Column A and B contain 'NaN' and double values. However, such mixing of data types is not possible in Matlab (unless it is a column of cells). Attaching the file will be helpful in this case.

Iniciar sesión para comentar.

Categorías

Más información sobre Numeric Types en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by