compiling matlab code: works in Matlab but not in cmd.exe

1 次查看(过去 30 天)
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 个评论
Ben
Ben 2014-10-9
编辑:Ben 2014-10-9
i have the same problem. even if i change the parfor to a for, the compiled code errors out on gmdistribution saying it is an undefined variable or class. this is with 2014a on 64-bit linux. works fine on the command line though.

请先登录,再进行评论。

回答(2 个)

Titus Edelhofer
Titus Edelhofer 2014-10-9
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

Titus Edelhofer
Titus Edelhofer 2014-10-9
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

类别

Help CenterFile Exchange 中查找有关 Parallel Computing Fundamentals 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by