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

3 ビュー (過去 30 日間)
Tom Holden
Tom Holden 2015 年 4 月 8 日
回答済み: Tom Holden 2015 年 4 月 18 日
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").
Tom Holden
Tom Holden 2015 年 4 月 8 日
But doing this apparently results in a project which R2015a can no longer load!

サインインしてコメントする。

採用された回答

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 Center および File ExchangeMATLAB Coder についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by