Hello everyone,
Does anyone know why I just get NaN as a result?
D=giuliayearlyDELTA2.Height;
E=str2double(D);
NEW_4=E *0.35 *10;
Thank you!

 Respuesta aceptada

Star Strider
Star Strider el 8 de Ag. de 2021

0 votos

There is one NaN value in ‘giuliayearlyDELTA2.Height’.
However, the str2double call is not necesary.
Just do:
D = giuliayearlyDELTA2.Height
NEW_4=D *0.35 *10;
.

2 comentarios

Pul
Pul el 8 de Ag. de 2021
Thank you!
Star Strider
Star Strider el 8 de Ag. de 2021
As always, my pleasure!
.

Iniciar sesión para comentar.

Más respuestas (2)

KSSV
KSSV el 8 de Ag. de 2021

0 votos

D=giuliayearlyDELTA2.Height;
E=D;
NEW_4=E *0.35 *10;
D is not a string. You need not to ue str2double; already D is in double.
Ive J
Ive J el 8 de Ag. de 2021

0 votos

First, Height is already double, so
A = 2;
str2double(A)
ans = NaN
Secondly, first element of Height is NaN. Remove it prior to the analysis.

Categorías

Más información sobre Data Type Conversion en Centro de ayuda y File Exchange.

Preguntada:

Pul
el 8 de Ag. de 2021

Comentada:

el 8 de Ag. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by