is it a bug?

2 visualizaciones (últimos 30 días)
G A
G A el 7 de Jul. de 2019
Editada: per isakson el 7 de Jul. de 2019
str2num('"abc"')
ans =
"abc"
  2 comentarios
Image Analyst
Image Analyst el 7 de Jul. de 2019
What were you expecting to see?
G A
G A el 7 de Jul. de 2019
Editada: G A el 7 de Jul. de 2019
In the version r2015b, the answer was []. I do not think that "abc" is a number.

Iniciar sesión para comentar.

Respuesta aceptada

per isakson
per isakson el 7 de Jul. de 2019
Editada: per isakson el 7 de Jul. de 2019
I call this a bug.
My comments
The last lines of str2num() read
if ischar(x) || iscell(x)
x = [];
ok = false;
end
Adding || isstring to the condition solves the problem - I think.

Más respuestas (0)

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by