Why does the function 'str2double' run incorrectly

1 次查看(过去 30 天)
Using the official example for the function 'str2double', an error is actually reported.
Examples are as follows:
Actual operation result:
  2 个评论
Stephen23
Stephen23 2023-6-20
编辑:Stephen23 2023-6-20
Perhaps there are some invalid characters present in the strings. This often happens when users copy-paste examples from HTML documents (e.g. webpages) and inadvertently copy newlines or non-breaking spaces or something similar. Or some "smart" character replacement is provided by your OS: those decimal points certainly look strange (but that might just the font you are using).
So, check the character codes yourself. Or save the variable STR in a MAT file and upload it here by clicking the paperclip button, and we can show you how to check the character codes. We cannot run screenshots, we need your data.
Also show us the complete output of this command:
which str2double -all
Dyuman Joshi
Dyuman Joshi 2023-6-20
编辑:Dyuman Joshi 2023-6-20
Can you copy and paste the whole error?
What is the output when you run the following line of code in your MATLAB -
which str2double -all

请先登录,再进行评论。

回答(1 个)

John Smith
John Smith 2023-6-20
移动:Cris LaPierre 2023-6-20
I just found out what caused the error. I used a third-party package some time ago, and when I unpath the package, the problem disappears.
Thank you for your help.

类别

Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

标签

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by