MATLAB: Relocating a MATLAB Compiler project to a different machine and recompiling

compilerMATLAB Compilerproject file

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.

Best Answer

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:
<fileset.main>
<file>${PROJECT_ROOT}\surfPlot.m</file>
</fileset.main>
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.