MATLAB Answers

G A
0

is it a bug?

Asked by G A
on 7 Jul 2019
Latest activity Edited by per isakson
on 7 Jul 2019
str2num('"abc"')
ans =
"abc"

  2 Comments

Image Analyst
on 7 Jul 2019
What were you expecting to see?
G A
on 7 Jul 2019
In the version r2015b, the answer was []. I do not think that "abc" is a number.

Sign in to comment.

Tags

Products

1 Answer

per isakson
Answer by per isakson
on 7 Jul 2019
Edited by per isakson
on 7 Jul 2019
 Accepted Answer

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.

  0 Comments

Sign in to comment.