Matlab/Simulink中的一个常见问题

在网上下载的仿真模型或者打开别人的模型,有可能出现这样的错误:

Warning: Unable to load model file ‘C:\Documents and Settings\topcool\Desktop\abc.mdl’ due to the presence of characters that are not supported in the current character encoding setting ‘GBK’. Either:
1) run “bdclose all; set_param(0,’CharacterEncoding’, Enc)” where Enc is one of Shift_JIS, windows-1252, ISO-8859-1, then load the model, or
2) remove the unsupported characters. The first such character occurs on line 458, byte offset 22.

解决的方法就是按照上面的提示在工作空间里输入下面的命令:

  1. bdclose all;
  2. Enc=’windows-1252′;
  3. set_param(0,’CharacterEncoding’,Enc);

然后再到上面菜单里点打开文件。

有的时候自己做的模型可能出现无法保存的情况,也是编码的问题,有可能是输入了中文,
也有可能是输入了特殊的字符,比如角度值的那些罗马字符。

这个时候可以在工作空间下输入命令:

  1. set_param(’ModelName’, ‘SavedCharacterEncoding’, ‘ISO-8859-1′)

其中的ModelName是自己的mdl模型名字。

还有个要注意的是模型所在的目录必须是英文的,不要有中文字符。。

Popularity: 18% [?]

No tag for this post.
Related posts

cirtexhosting_ads.gif

Leave a Reply

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word