Why can't I create a deployable archive (.ctf) with code containing enumerations in R2015a

조회 수: 4 (최근 30일)
We want to upgrade our MatLab Production Server from 2013b to 2015a. When I try to create a Deployable archive of our software with the 2015a compiler I get an "Invalid file types" error after selecting the .m files in the EXPORTED FUNCTIONS dialog. We also get the message "Only MATLAB functions and MEX Files with a single entry point are acceptable as exported functions.", then a list of the four enumeration files are listed beneath. If I exempt the enumeration .m files in the EXPORTED FUNCTIONS dialog then I get no errors. The same code compiles with no problems under the 2013b compiler. We do have both MatLab 2013b and MatLab 2015a desktop versions with compiler installed on the same computer with only the 2015a running, both installed to their default locations on the C drive. I've done a lot of Googling about this problem but come up empty handed. Hope someone can help with this problem.

채택된 답변

Jorik
Jorik 2015년 4월 15일
Enumeration and class definition files are not MATLAB function files and as such cannot be used as one of the exported functions for a MATLAB Compiler (SDK) project. In most cases the dependency analysis of MATLAB can automatically detect which enumeration and class definitions are necessary for your project.
If the dependency analysis is unable to find some required files, you can manually add these files in the "Files required for your archive to run" section.
There can indeed be some changes in how file types and dependencies are recognized between R2013b and R2015a. This is a result of the new dependency analysis function was introduced in R2014a: http://www.mathworks.com/help/compiler/release-notes.html
  댓글 수: 1
Barry Carnahan
Barry Carnahan 2015년 4월 21일
편집: Barry Carnahan 2015년 4월 21일
This is the answer to my question, however, I find the compiler a little confusing. In 2013b you could choose all functions and classes in the 'EXPORTED FUNCTIONS' dialog and create the ctf file. In this case there would be no entries under the 'Files required for your archive to run' section. In 2015a, if you choose all functions and classes then you get what appears to be an error on the class enumerations (not the other classes), but it's more informational seeing that the compiler, after pressing 'Ok', automatically adds the class enumerations to the 'Files required' section (not the other classes). If you create the ctf file and test it, it works fine. If you indeed only choose the functions in the 'EXPORTED FUNCTIONS' dialog, then you get no errors and the compiler automatically adds ALL class definitions to the 'Files required' section. If you then create the ctf file and test it, it too works fine. I wouldn't call it buggy, but it could be more consequent and clearer that you could proceed with the compilation after getting an 'invalid file types' error.

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

추가 답변 (1개)

shwetha gn
shwetha gn 2020년 2월 3일
편집: Walter Roberson 2020년 2월 3일
make your code as a function
Try the following syntax:
function output1 = Your_function_name() % just preced your code with this statement with an appropriate function name
% Your code
end
For example:
function output1 = addn()
a=1;
b=2;
output1=a+b;
end
then in command window type
deploytool
select library compiler
if it is a dot net application select .Net Assembly then click on + symbol to include the .m function, then finally click on package
to build the dll file.

카테고리

Help CenterFile Exchange에서 C Shared Library Integration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by