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

19 次查看(过去 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 中查找有关 Dependency Analysis 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by