| MATLAB® | ![]() |
| On this page… |
|---|
A locale is part of the user environment definition. It defines language, territory, and codeset, which is a coded character set. The MATLAB® process uses the user-specified locale name on all platforms. MATLAB also reads the user-specified UI language name, and uses it to select localized resources in the specified language. By using this feature, a user can select localized resources in US-English. The user-specified UI language setting also controls language and country settings of the Sun™ Java™ Virtual Machine (JVM™) software.
Consider the following when choosing your locale settings. To see what settings you are using, use the instructions in Setting the Locale.
Default Locale Setting — If the user-specified locale is not supported, MATLAB uses the default locale en_US.US-ASCII.
UI Language Setting — The UI language setting should be set to either the same language as the user specified locale or to US-English. Otherwise, non-7-bit ASCII characters may not display properly.
Supported Encoding Scheme — MATLAB may not properly handle character codes greater than 2 bytes.
Supported Character Set — MATLAB supports the character set specified by the user locale setting.
M-File Compatibility — Non-7-Bit ASCII characters in M-files created on one platform may not be compatible on other platforms using different locale settings.
Platform-Specific Localized Formats — MATLAB usually uses platform-neutral localized formats and rules.
Microsoft® Windows® Platform Requirement — User locale and system locale must be the same value. If these values are not the same, users may see garbled text or incorrect characters. For information on controlling these settings, see Locale Settings on Windows® Platforms.
Apple® Macintosh® OS X Platform Restriction — MATLAB automatically chooses a codeset for each combination of language and territory. In Version 10.5 of the OS X operating system, MATLAB ignores the LANG environment variable.
Macintosh OS X Version 10.5 Platform Restriction — When you run MATLAB software with the -nodesktop startup option, the MATLAB locale setting is not the Macintosh locale setting for the Terminal application. For example, for users selecting the Japanese_Japan region on the Formats tab, the MATLAB locale setting is ja_JP.sjis. The Macintosh locale setting is ja_JP.UTF-8.
To ensure the correct calculation of functions using date values, replace datenum function calls with the use of the dir function datenum field.
For example, look at the modification date of your MATLAB license.txt file:
cd(matlabroot)
f=dir('license.txt')MATLAB displays information similar to:
f =
name: 'license.txt'
date: '10-May-2007 17:48:22'
bytes: 5124
isdir: 0
datenum: 7.3317e+005If your code uses a command similar to:
n=datenum(f.date);
you must replace it with:
n=f.datenum;
MATLAB reads the user locale for all categories except for the LC_NUMERIC category. This category controls numeric data formatting and parsing. MATLAB always sets LC_NUMERIC to the C locale.
For example, some users expect a comma in a number while other users expect a decimal. The value of pi can be displayed as 3.1415 or 3,1415, depending on the format used by a locale. MATLAB always uses 3.1415, regardless of the format specified by the user locale.
This topic describes how to set locale values on various platforms.
MATLAB uses the system locale and user locale on Windows platforms.
Setting User Locale. This topic describes how to set the user locale on each Windows platform.
Windows Vista™ Platforms.Select Start -> Control Panel -> Regional and Language Options
Open Formats tab
Select an item from the drop-down list
Select Start -> Control Panel -> Regional and Language Options
Open Regional Options tab
Select an item from the drop-down list
Setting System Locale. This topic describes how to set the system locale on each Windows platform.
Note When you change the system locale, you must reboot your system; otherwise, you may see unexpected locale-setting behaviors. |
Select Start -> Control Panel -> Regional and Language Options
Open Administrative tab
Click Change system locale... button
Select an item from the drop-down list
Reboot the system
Select Start -> Control Panel -> Regional and Language Options
Open Advanced tab
Select an item from the drop-down list
Reboot the system
Linux®[1] and Sun Solaris™ platforms manage locale settings with six locale categories. These are the same categories used by C standard library functions.
The following locale categories are available:
LC_CTYPE controls character data manipulations
LC_COLLATE controls character collation/sorting operations
LC_TIME controls date/time data formatting or parsing
LC_NUMERIC controls numeric data formatting or parsing
LC_MONETARY controls monetary data formatting or parsing
LC_MESSAGES controls the user UI language
Setting User Locale and User UI Language. Use the LANG environment variable to specify a single locale for all locale categories. The locale specified with this variable may be partially or entirely over-written by other environment variables.
Use the environment variables LC_CTYPE, LC_COLLATE, LC_TIME, LC_NUMERIC, and LC_MONETARY to specify a locale for a particular category.
Use the LC_ALL environment variable to over-write all locales specified with other environment variables. If a single locale has to be set to all locale categories, use LANG instead of LC_ALL.
The Macintosh OS X platform manages the user locale setting and the user UI language setting.
Select System Preferences ->International
Open Formats tab
Select an item from the Region pop-up menu
Select System Preferences ->International
Open Language tab
Drag an item to the top of the Languages list
![]() | Accessibility | Running Functions — Command Window and History | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |