How the MATLAB Process Uses Locale Settings

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, you can select localized resources in US-English. The user-specified UI language setting also controls language and country settings of the Java® Virtual Machine (JVM™) software.

The term I18n is an abbreviation for internationalization, where 18 stands for the number of letters between the i and the n.

To set or view the current settings, see:

Consider the following when choosing your locale settings.

  • Default Locale Setting — If the user-specified locale is not supported, MATLAB uses the default locale en_US.US-ASCII.

  • UI Language Setting — Set the UI language to either the same language as the user-specified locale or to US-English. Otherwise, non-7-bit ASCII characters might not display properly.

  • Supported Character Set — MATLAB supports the character set specified by the user locale setting. However, MATLAB might not properly handle character codes greater than 2 bytes.

  • Script Compatibility — Non-7-bit ASCII characters in MATLAB scripts created with one locale setting might not be compatible with a different locale setting.

    For example, if you create a script with the ja_JP.UTF-8 locale setting, the script might not be compatible when executed on a platform with the ja_JP.eucJP locale setting.

  • Numeric Format Uses C Locale — 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 more information, see Numbers Display Period for Decimal Point.

  • Platform-Specific Localized Formats — MATLAB usually uses platform-neutral localized formats and rules. You can, however, use the operating system short date format to control the format for displaying file date and time data.

Windows Platform-Specific Behavior

The user locale and system locale must be the same value on the Microsoft® Windows® platform. If these values are not the same, you might see garbled text or incorrect characters. For information on controlling these settings, see Setting Locale on Windows Platforms.

Mac Platform-Specific Behavior

On the Apple Mac OS X platform, MATLAB reads the user locale setting and the user UI language setting. For information on controlling these settings, see Setting Locale on Mac Platforms. If you customize the locale setting on Mac OS X, MATLAB ignores the customized portion. MATLAB ignores the LANG environment variable and the Terminal application locale setting.

MATLAB automatically chooses a codeset for each combination of language and territory on the Mac OS X platform.

Was this topic helpful?