Saving a MATLAB Coder R2015a project in a format compatible with prior versions

3 views (last 30 days)
I am the author of a large MATLAB toolbox, including MATLAB Coder projects. These Coder projects are automatically compiled on the user's computer. Until recently, the Coder project file I was using had not been updated since MATLAB R2012a, and as a result, they worked perfectly whatever version of MATLAB the user had.
I recently made the mistake of editing the Coder project from R2015a, and saving it again. The result appears to be a Coder project in a new format which prior versions of MATLAB cannot open.
Is there any way of forcing R2015a to save Coder projects in a backwards compatible format?
  2 Comments
Tom Holden
Tom Holden on 8 Apr 2015
A hack approach seems to be possible via manually editing the first two lines of the .prj file. To be backwards compatible, it should start as follows:
<deployment-project plugin="plugin.matlabcoder" plugin-version="R2015a">
<configuration build-checksum="..." file="..." location="..." name="..." target="target.matlab.coder" target-name="MEX, C, and C++ Code Generation">
where the ... should be left as they were.
The changes are the renamed plugin (from "plugin.coder"), the renamed target (from "target.unifiedcoder") and the renamed target-name (from "MATLAB Coder").

Sign in to comment.

Accepted Answer

Ji Lee
Ji Lee on 8 Apr 2015
Hi Tom,
Unfortunately, there is no mechanism in place for backwards conversion of projects. As you have gathered from this, these projects were not designed to support a workflow involving regular use from multiple releases.
Fortunately, targeted modification of the XML as you have attempted get your project opening in R2012a again. Before continuing, I would strongly advise you to back up your R2015a project file if you have not done so already.
You were actually very, very close to getting it to work! The only thing you need to change in that XML snippet you posted is the "plugin-version" attribute. Instead of saying "R2015a", it should be set to "R2012a". With that additional change, you should be able to open the project in R2012a again. Still, I would recommend that you look over your settings afterwards to make sure nothing is lost. When the project specification gets updated every release, it is the possible removal, remapping, merging, and splitting of things in old projects that may result in the localized loss of information when manually modifying project files.
  1 Comment
Tom Holden
Tom Holden on 8 Apr 2015
It did open fine in R2012a without that additional change. The problem was that the modified file then refused to open in R2015a. But your additional change got it to compile file in R2015a, so this was indeed the problem.
Thanks.

Sign in to comment.

More Answers (1)

Tom Holden
Tom Holden on 18 Apr 2015
For other people experiencing this issue, another workaround is using: "coder -tocode projectname -script scriptname" to generate a script that performs the same function as building the project, but that should be more backwards compatible.

Categories

Find more on MATLAB Coder in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!