Referencing Projects from a Simulink Project
This example shows how to use referenced projects as independent components within your project.
Setting Up the Example Files and Opening the Simulink Project Tool
1. Run the following commands to create and open a working copy of the project files.
Simulink.ModelManagement.Project.projectDemo('airframe_refs', 'svn', true);
Creating sandbox for project. Created example files in "/private/tmp/BR2017bd_681905_31616/bml.batserve.002620/work/MATLAB/projects/slexamples/airRef" Starting: Simulink Initializing: Project Path Identifying shadowed project files Initializing: Project Path Identifying shadowed project files Initializing: Project Path Setting up working folders Identifying shadowed project files
How Referenced Projects Work
When the parent project is loaded, the referenced projects are loaded first, to add project paths from the referenced project to the MATLAB search path, and to run startup shortcuts from the referenced projects.
- You can run the shortcuts in referenced projects from the parent project, using the Project Shortcuts tab.
- You can examine and open referenced projects by clicking Reference on the Simulink Project tab.
Example Referenced Projects
This project provides an airframe simulation which brings in functionality from these other projects by referencing them:
- Signal Multiplier: This referenced project shows how to develop an S-function as an independent project. The referenced project provides source code, build support and path management. The build directory is on the project path, so it is also on the path for the parent project. You can run the "rebuild s-function" shortcut from the parent project on the Project Shortcuts tab.
- Wind Gust library: This referenced project provides a library and a data dictionary that contains the required bus objects for the library. This project's path ensures that the library is set up for use in the parent project.