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

2 次查看(过去 30 天)
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 个评论
Tom Holden
Tom Holden 2015-4-8
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").

请先登录,再进行评论。

采纳的回答

Ji Lee
Ji Lee 2015-4-8
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 个评论
Tom Holden
Tom Holden 2015-4-8
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.

请先登录,再进行评论。

更多回答(1 个)

Tom Holden
Tom Holden 2015-4-18
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.

类别

Help CenterFile Exchange 中查找有关 MATLAB Coder 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by