is it a bug?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
G A
el 7 de Jul. de 2019
Editada: per isakson
el 7 de Jul. de 2019
str2num('"abc"')
ans =
"abc"
2 comentarios
Respuesta aceptada
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 old function, str2num(), uses eval() to do the conversion. "Eval is evil" or at least tricky to use. See https://se.mathworks.com/matlabcentral/answers/51946-systematic-do-not-use-global-don-t-use-eval#answer_63393
- The data type, string, is new.
- str2num('"abc"') is a clever test case, which I assume is not in their test suite.
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.
0 comentarios
Más respuestas (0)
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!