MCR executable different than original code
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I am using matlab to compile an .exe file, but when I run it I get error messages in several places that do not cause errors in the original code. For example, when I use the pdf function (from gmdistribution in the stats toolbox, which I included when compiling) I get:
Original code (gmq is definitely a distribution):
t=pdf(gmq,[xx(:,1) xx(:,2) xx(:,3)]);
Error message: {Error using pdf (line 54)
Requires the first input to be the name of a distribution.
Error in expectationsf_v1 (line 45)}
stats:pdf:BadDistribution
I've was able to get around this error somewhat. The problem (thanks Kaustubha!) was that the pdf function cannot tell that I am referring to the gmdistribution class when it's compiled, so I renamed the function gmpdf. That still didn't work though because there seems to be a problem with using objects in compiler. For example, when I run something like:
gm_cells{i,p}=gmdistribution.fit(xdata{s,q,ff},1,'Start','randSample','Options',options,'Regularize',1,'SharedCov',true,'Replicates',200);
gm{i,1}=gm_cells{i,p}.mu;
gm{i,2}=gm_cells{i,p}.Sigma;
gm{i,3}=gm_cells{i,p}.PComponents;
When I run this in matlab it works fine, but when I compile it and run the .exe I get the error message:
{Attempt to reference field of non-structure array.
Error in model13_main (line 243)
}
MATLAB:nonStrucReference
Does anyone have ideas about what the problem may be, or how to debug the code given that I can't replicate the error messages in matlab? I'm using 2011b and MCR version 7.16.
3 Kommentare
Arjun Viswanathan
am 4 Apr. 2014
I had a similar error. The solution was to make sure all my classdef .m files were included in the "Files required for your application to run" box in applicationCompiler. That solved the issue for me.
Antworten (3)
Kaustubha Govind
am 15 Mär. 2012
It seems like the deployed version of the code is picking up the generic version of the pdf function which expects the first argument to be a string containing the name of a distribution, instead of gmdistribution.pdf. Somehow, the gmdistribution class is not getting compiled and included in the CTF correctly. I would recommend contacting MathWorks Tech Support if this is a bug that they have a resolution for.
0 Kommentare
owr
am 16 Mär. 2012
Whenever I run into errors like this using objects in a deployed appllication, I try the fix described here:
<http://www.mathworks.com/support/solutions/en/data/1-C2PQWJ/index.html?product=CO&solution=1-C2PQWJ>
I havent looked at the details of your specific case much, but its an easy quick test.
Good luck.
0 Kommentare
cem polat
am 6 Aug. 2015
I had the same problem with Matlab 2014b and java compiled MCR code. I used fitgmdist instead of gmdistribution.fit and my problem was solved. Now that both MATLAB and java MCR class method works the same. fitgmdist is also offered by MATLAB help since gmdistribution.fit will be removed in a future release.
0 Kommentare
Siehe auch
Kategorien
Mehr zu MATLAB Compiler finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!