is it a bug?

2 Ansichten (letzte 30 Tage)
G A
G A am 7 Jul. 2019
Bearbeitet: per isakson am 7 Jul. 2019
str2num('"abc"')
ans =
"abc"
  2 Kommentare
Image Analyst
Image Analyst am 7 Jul. 2019
What were you expecting to see?
G A
G A am 7 Jul. 2019
Bearbeitet: G A am 7 Jul. 2019
In the version r2015b, the answer was []. I do not think that "abc" is a number.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

per isakson
per isakson am 7 Jul. 2019
Bearbeitet: per isakson am 7 Jul. 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.

Weitere Antworten (0)

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by