Relocating a MATLAB Compiler project to a different machine and recompiling

조회 수: 4 (최근 30일)
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.

채택된 답변

Chaitra
Chaitra 2014년 6월 25일
편집: Chaitra 2014년 6월 25일
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.
  댓글 수: 3
Chaitra
Chaitra 2014년 6월 26일
If you are moving the files to a different machine, you need to physically move the files indicated in ".prj" to a new location and update the file locations manually in ".prj" file.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Andrew Janke
Andrew Janke 2018년 6월 19일
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
Matt J
Matt J 2018년 6월 20일
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?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 MATLAB Compiler에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by