Why do I receive character incompatibility errors when loading a model in Simulink 6.0 (R14)?

12 次查看(过去 30 天)
It appears I need to set the character encoding using SLCHARACTERENCODING. When I tried to open my model, I received the following error:
ERROR: Warning: Model '...' contains characters incompatible with the current MATLAB
character encoding setting '<character encoding>'.
Please use the 'slCharacterEncoding' command to change the setting to one
of the following encodings:
'Shift_JIS, ISO-8859-1', before loading this model.
Type 'help slCharacterEncoding' for usage information.
I then followed the instructions to get help on SLCHARACTERENCODING.
help slCharacterEncoding
However, I received another error:
ERROR: slCharacterEncoding.m not found.
Use the Help browser Search tab to search the documentation, or
type "help help" for help command options, such as help for methods.
There is no help for SLCHARACTERENCODING. Why is this occurring and what can I do to resolve it?

采纳的回答

MathWorks Support Team
编辑:MathWorks Support Team 2021-12-13
This bug has been fixed for Release 14 (R14). For previous releases, please read below for any possible workarounds:
In order for the Simulink to correctly handle strings containing non-ASCII characters, the model loader will pre-scan an MDL-file for non-ASCII characters. If any such characters are found and are inconsistent with the current MATLAB encoding setting, model loading will stop and the warning described above will be displayed.
The SLCHARACTERENCODING function forces Simulink to use a different character encoding than the one that MATLAB is using. If it is likely that the extended characters come from a European character set, use the command:
slCharacterEncoding('ISO-8859-1');
If it is likely that the extended characters come from an Asian character set, use the command:
slCharacterEncoding('Shift_JIS');
This command will only be active for the current MATLAB session. If you will frequently be loading models from a non-ASCII character set, you should place this command in your startup.m file so that it is loaded every time that MATLAB is started. See the following URL for more information on how to do this:
Note that the documentation for SLCHARACTERENCODING command is missing in Simulink 6.0 (R14). The following is the documentation for SLCHARACTERENCODING.
SLCHARACTERENCODING: Change the MATLAB character set encoding.
If you have a model containing non-ASCII characters, you need to change the MATLAB
character set encoding to be compatible with these characters before loading the model.
Currently, we support: US-ASCII, UTF-8, Shift_JIS, ISO-8859-1.
Note: You need to close all open models or libraries before changing the MATLAB
character set encoding except when changing from 'US-ASCII' to another encoding.
Examples:
slCharacterEncoding() % return the current MATLAB character
% set encoding
slCharacterEncoding('Shift_JIS') % change the MATLAB character set encoding
% to Shift_JIS

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Interactive Model Editing 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by