![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/176082/image.png)
Error: A part name shall not have a forward slash as a last character [M1.5]
52 次查看(过去 30 天)
显示 更早的评论
Hi I get the following error trying to open an slx file:
Error using open (line 163) File 'H\:My Documents\MATLAB\Fil2\FIL2.slx' does not contain a valid Simulink model in SLX format: A part name shall not have a forward slash as a last character [M1.5]
What has happened to it, and how can I fix it?
0 个评论
采纳的回答
Jon Boerner
2014-10-13
To start, SLX files are just ZIP files with a particular set of files and using a particular compression method.
Looking around the internet for this error, it looks like the only way to recreate the error is to manually edit the files in the SLX/ZIP file. For example, I can reproduce it with:
- Create a model (with SLX extenstion), called 'mymodel.slx' - Make a copy of the model, called 'copy_of_mymodel.slx' - Rename both files to have a '.zip' extension (i.e. mymodel.zip) - In the MATLAB file browser, copy a file from 'mymodel.zip' to the same location in 'copy_of_my_model.zip' and overwrite it - Now if I change the extensions back and try to open the copy, I get the error
After poking around a bit, I think that the reason this causes an error is that it has a strange effect on how the ZIP file is organized.
For me, I could work around the issue with the following steps:
1. For the corrupted model in question, change the file extension to '.zip'
2. In the MATLAB folder browser, right-click the file and choose "Extract". This should make a folder.
3. Open WinZip
4. Drag the contents of the folder into WinZip (don't drag the folder itself or the ZIP file will be wrong. Just drag the contents)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/176082/image.png)
5. WinZip will open a pop-up. Select the option to choose your own compression method, and choose SuperFast.
6. For the destination, pick whatever you want, just have it end with an slx extension
This looked like it resolved the issue for me. I am not sure if it would be the same for you, since I don't know what caused the issue in the first place, but probably worth a shot.
3 个评论
Jon Boerner
2014-10-15
Glad to hear it worked! Just a suggestion, but you might want to look into some source control as a precautionary measure moving forward. There is something called Simulink Projects that integrates GIT or SVN right into the MATLAB IDE and is built for use with Simulink.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interactive Model Editing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!