Why does MATLAB return a number with a comma as a decimal point?
2 views (last 30 days)
Show older comments
Why does MATLAB return a number with a comma as a decimal point?
My Window's Regional and Language Setting is set to an area where the decimal point is represented as a comma. Why does MATLAB return numbers with a decimal comma, but when I try to use this number in another function, I get an error.
To see the bug, go to Windows' Control Panel -> Regional Options
and switch your system to a locale with a decimal comma.
Then start MATLAB and issue the command:
plot(1)
Now, hit the 'Show Plot Tools' button. When the tools are up, click on an axis of the figure, such that the bottom section of the figure showsthe 'Property Editor - Axes'. Type a fractional limit for X, Y, or Z axis and click anywhere outside the edit field to make the input active. The decimal point in the input field is replaced by a comma.
Since MATLAB does not use the decimal comma, an error dialog box opens when the limit is changed without replacing the comma by a point. When used as an argument in another function, this causes an error.
Accepted Answer
MathWorks Support Team
on 27 Jun 2009
This bug has been fixed for Release 14 SP1 (R14SP1). For previous releases, please read below for any possible workarounds:
This is a bug in MATLAB. MATLAB uses the underlying Windows Language Settings for outputting answers, which could be set to one of the languages that use commas to symbolize a decimal. However, it does not recognize this as a proper number when it is used in a function call.
As a workaround, the user can just replace the comma with a point.
0 Comments
More Answers (0)
See Also
Categories
Find more on Dialog Boxes in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!