matlab 打开模型报错误使用open line145 does not contain a valid modle in SLX format :could not open sourse package
根据提供的参考资料和错误代码和信息,该问题可能是以下其中的一个原因导致的:
解决方案:
代码示例:
old_path = '路径中的中文';
new_path = 'Path in English';
movefile(fullfile(old_path, 'xx.slx'), fullfile(new_path, 'xx.slx'));
slx_file = 'xx.slx';
mdl_file = 'xx.mdl';
open_system(slx_file);
save_system(mdl_file);
close_system(slx_file);
直接修改Matlab的安装路径即可。
% 首先获得路径中的中文乱码
old_path = '路径中的中文乱码';
new_path = correct_path(old_path); % 使用一些字符串处理函数将乱码转换为正确的中文或英文
movefile(fullfile(old_path, 'xx.slx'), fullfile(new_path, 'xx.slx'));