MATLAB Answers

is it a bug?

1 view (last 30 days)
G A
G A on 7 Jul 2019
Edited: per isakson on 7 Jul 2019
str2num('"abc"')
ans =
"abc"

  2 Comments

Image Analyst
Image Analyst on 7 Jul 2019
What were you expecting to see?
G A
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.

Accepted Answer

per isakson
per isakson on 7 Jul 2019
Edited: per isakson on 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.

  0 Comments

Sign in to comment.

More Answers (0)

Tags

Products

Community Treasure Hunt

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

Start Hunting!

Translated by