Error: A part name shall not have a forward slash as a last character [M1.5]

조회 수: 89 (최근 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?

채택된 답변

Jon Boerner
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)
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
Mikael Sahlin
Mikael Sahlin 2014년 10월 15일
Thank you sir! I'm very thankful. You might just have saved my thesis and 3 months work!
Jon Boerner
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 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