compiling matlab code: works in Matlab but not in cmd.exe
1 view (last 30 days)
Show older comments
Hello all,
I have a program that use parallel toolbox. That works perfectly in Matlab but when I compile it and execute it in cmd.exe, I get this error: Matlab cannot determine whether 'gmdistribution' refers to a function or variable. See Parallel for Loops in Matlab, 'Unambiguous Variable Names'. Matlab:mir_error_parfor_ambiguous_name.
The program crashes in this row:
gm{k} = gmdistribution.fit(X,ngseq(k),...
'Regularize',Regularize,...
'Replicates',Replicates,...
'Start',Start,...
'CovType',CovType,...
'SharedCov',SharedCov,...
'Options',gmoptions);
I'm using matlab (2014a) and mcr 8.3 (2014a)| Thank you
1 Comment
Answers (2)
Titus Edelhofer
on 9 Oct 2014
Hi,
I'm not sure yet about the parfor part of the question. You are right, the compiler should pick up the code automatically. As a workaround you can help him here by adding the folder matlabroot\toolbox\stats\stats\@gmdistribution to the "Files required for your application to run". It should then add all files of that folder, and then (at least without parallel computing) it works. Since in this case parfor "knows" what gmdistribution.fit is, my guess is, that the parfor problem will go away as well.
Titus
0 Comments
Titus Edelhofer
on 9 Oct 2014
Hi,
I just made another test: replacing gmdistribution.fit by fitgmdist (as the help for gmdistribution.fit suggests, because gmdistribution.fit will be removed) solves the problem as well.
It looks as if the compiler is one step ahead of MATLAB ;-).
Titus
0 Comments
See Also
Categories
Find more on Parallel Computing Fundamentals in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!