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 个评论
回答(2 个)
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
0 个评论
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
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Parallel Computing Fundamentals 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!