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

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