Everyone loves a package… Especially a Hyperloop simulation.
In case you forgot, tomorrow is Valentine's Day. Instead of going for the classic bouquet of flowers or box of chocolates, why not be original and give something that will last forever... a well packaged Simulink Project.
Because he loves all of you, Matt Brauer released his Simulink model of the Hyperloop on the MATLAB Central File Exchange.
Let's see how Matt used the Archive capability of Simulink Projects to package the model and its dependent files... and ended up with a nicely packaged Simulink Project!
Packaging a Simulink Project
I’ve often run into problems when sending Simulink models to colleagues. With all the scripts, functions and libraries, it’s hard to keep track of all the file dependencies. I could zip up my complete working folder with standard tools. But, there are quite a few files in process or archived that I don’t necessarily want to share. I could try to remove all those files, but, I might remove something that I actually need. Luckily, there are features within Simulink Projects that can help.
Don’t over-share
Simulink Projects differentiates between files that are within your working directory and those that are considered part of the project. You can see below how the All Files view differs from the Project Files view for my hyperloop work. Zipping up the complete folder would definitely include more than I want to share. On the other hand, an Archive will only include the Project Files.
All Files within my Hyperloop folder (on left) and the Project Files associated with my Hyperloop project (on right)
Don’t forget anything
I use the Dependency Analysis to see how my Project Files are related. Here’s a graphical view of the dependencies. Notice how the types of files and relationships (Reference Type) are shown. Even model callbacks, which can be hard to find manually, are identified.
Impact view of the Dependency Analysis
This analysis will highlight if any dependent files are missing from the project. Oops, looks like I forgot to add an enumeration definition.
Impact view of the Dependency Analysis showing a file not included in the project.
Tying the Ribbon
When you’re confident that the project is just right, packaging it into an archive is simple. Just click the Archive button (that looks like a package) in the Simulink Project pane and select a name and location for the zipped archive file. Now the project is ready for distribution.
Opening the Package
When the recipient wants to run the model, they just need to select New > Simulink Project > From Archive and select the file and destination directory. Imagine the smiles on their faces!
Now it's your turn
What do you think of Matt's gift? Are you interested to contribute?
How do you distribute Simulink models with many dependencies? What problems do you run into?
Let us know by leaving a comment here.
댓글
댓글을 남기려면 링크 를 클릭하여 MathWorks 계정에 로그인하거나 계정을 새로 만드십시오.