Relocating a MATLAB Compiler project to a different machine and recompiling

19 views (last 30 days)
I have a project file (.prj file) created using the MATLAB Compiler deploytool. Now, however, I would like to pack up the .prj file and all the dependent .m and .mat and .fig files it points to, move them to a different machine, and recompile there.
I assume that the .prj file uses absolute paths to find the dependent files at compile time, and that if I relocate the files, I will break the project. Is this true and, if so, is there a way around these difficulties? For example, is it possible to export the project in a form where it explicitly stores copies of all its dependent files?
The goal here is to avoid re-composing the project on the new machine. The deploytool is not foolproof at searching for dependencies, and it would be a tedious iterative process to re-add missing dependencies until the project is correct. Pragmas are not a complete solution, because they don't apply to .mat and .fig files.

Accepted Answer

Chaitra on 25 Jun 2014
Edited: Chaitra on 25 Jun 2014
A .prj file contains information about your app, such as included files and a description. The .prj file enables you to update the files in your app without requiring you to re-specify descriptive information about the app. You can pack up the .prj file and all the dependent .m and .mat and .fig files it points to, move them to a different machine. You can then double click on .prj file and it opens the deploytool GUI. You can recompile the files. Relocation of files won’t cause them to break. However, if you are only relocating the “.prj” file to a different location in the same machine, you can right click on it and open it as text, this will show the location of files that are used by the application. For Ex:
Here my main file is located at a relative location indicated by : ${PROJECT_ROOT}\surfPlot.m
You can modify this location manually to indicate the location of main files or other files that are used by the application.
Note: “.prj” file is just a build file. You can omit the “.prj” file and move all the files that are needed in an application to another machine and use deploytool to recompile them. This will generate a new “.prj” file.

Sign in to comment.

More Answers (1)

Andrew Janke
Andrew Janke on 19 Jun 2018
Matt J: Where was your `.prj` file located initially? And what version of Matlab did you create it with?
I'm currently working on relocating some .prj files myself, and most of their paths, including all the paths to source files, were all relative paths defined with respect to `$PROJECT_ROOT`. I'm wondering why you ended up with absolute paths in your project file.
  1 Comment
Matt J
Matt J on 20 Jun 2018
Hi Andrew,
It's too long ago for me to recall exact details, I'm afraid. I was usually reasonably up to date with my Matlab versions at that time, so it was probably on R2013 or R2014. I thought perhaps that .prj files worked by cataloging Matlab toolbox files w.r.t `$PROJECT_ROOT`, but absolute paths for everything else. Do you definitely see your own user-defined source files defined with respect to PROJECT_ROOT?

Sign in to comment.


Find more on MATLAB Compiler in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!