How do I make the path length fixed for a Simulink Project Folder?

MATLAB/Simulink Project stored data mirrors the project folder structure, but adds ".type.File" to each level of each path.
This addition of characters, in conjunction with the relatively deep default path structures used by embedded coder targets, quickly exceeds the max path length of 260 characters.
Is there a way to reduce the path overhead from Simulink Project?  I am using Windows and I do not want to enable longer paths.

 Accepted Answer

The project can store its data using a fixed path length format that solves this issue. This setting avoids the path overhead of the project data and therefore averts exceeding the maximum path length. It is the default option since release R2020a.
To change the project definition file format for an existing project:
  • Go to MATLAB's preference dialog
  • Select the project preferences and set "Project definition files:" to "use multiple project files (fixed path length)"
All new projects should now use this format. You can read more about this setting in this page: 
To convert an existing project to use this format:
  • Set the preferences as described above
  • Export the project to a project archive. In the project toolstrip tab: select "Share->archive"
  • Double click on the newly created .MLPROJ file. This will create a new instance of the project using the fixed path data format
If your existing project is under source control in Git, there are a few extra steps:
  • Set the preferences as described above
  • Export the project via the "Share -> archive" menu. MATLAB automatically converts the metadata folder to a "resources" folder, and all paths, shortcuts, etc are saved in this process
  • Open the exported Project in MATLAB
  • Copy the metadata folder in the exported project. Prior to R2019a, projects' metadata folders may have been in either ".SimulinkProject", or "_SimulinkProject". In new releases, the recommendation is to use "resources" as the project metadata folder which is the default in R2019a and newer.
  • Delete the metadata folder in the original Project in Git. This folder is either "resources", ".SimulinkProject", or "_SimulinkProject"
  • Add the new metadata folder ("resources" and all subfolders/files) to Git in the original Project
  • Commit changes to Git

More Answers (0)

Categories

Find more on Project Management in Help Center and File Exchange

Products

Release

R2022b

Community Treasure Hunt

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

Start Hunting!