필터 지우기
필터 지우기

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

조회 수: 1 (최근 30일)
Doriana
Doriana 2014년 5월 19일
답변: Titus Edelhofer 2014년 10월 9일
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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by