필터 지우기
필터 지우기

Error when running compiled application: Undefined function ’webcammex'

조회 수: 14 (최근 30일)
I am using the Application Compiler to deploy my Matlab program (2015b). The packaging is successful but when I run it I’m getting the error:
Undefined function or variable 'webcammex'.
Error in matlab.webcam.internal.Utility.enumerateWebcams
Error in webcamlist (line 25)
Error in ...
MATLAB:UndefinedFunction
Does anyone know what’s causing this and what file I need to add when I compile the application?
Thanks.
  댓글 수: 3
Bernard Rivera Camacho
Bernard Rivera Camacho 2020년 3월 12일
Hello Rebecca
I have the same error I can run the Code in the Matlab application but not in the Stand alone application.
do you have a hint that i could follow?
Matlab 2014b 32 bit
Walter Roberson
Walter Roberson 2020년 3월 12일
FInd the webcammex.w32 file and add it to the dependencies ?

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2020년 5월 15일
I had this problem today and will show you how to fix it. When it hit
webcamlist
it threw the error: "Unrecognized function or variable 'webcammex'." Normally that command in the development environment would give something like this:
>> webcamlist
ans =
1×1 cell array
{'Integrated Webcam'}
So the webcam worked in development environment but not in the compiled standalone Windows executable, even though I had the required Support Package installed. Now I will tell you how to fix it.
First make sure you have the support package installed by going to the Home tab of the tool ribbon and selecting Add-Ons\Get Add-Ons.
Install the "MATLAB Support Package for USB Webcams".
Now, here's the unexpected thing (and why I had to call tech support). Unlike toolbox functions, Support Package functions are not automatically found and included/built-in to your function when you compile it. They need to be specifically added in with the '-a' option of the mcc function/command. So here is essentially how we got it to work (finally, after 20 minutes of trying different things with tech support):
mFileName = 'my_webcam_app.m'; % or whatever it's called. Change to match your m-file's name.
outputFolder = 'C:\My MATLAB Executables'; % Or wherever you want the compiled "my_webcam_app.exe" to go.
fprintf('Beginning compile of %s application at %s ...\n', mFileName, datestr(now));
tic;
% Now we're ready to compile.
% But first, make sure you change R2020a in the line below to whatever release year you're using.
mcc('-m', mFileName, '-d', outputFolder, '-a', 'C:\ProgramData\MATLAB\SupportPackages\R2020a\toolbox\matlab\webcam\supportpackages');
% Done compiling. Tell developer that we're done, and how long it took to compile.
elapsedSeconds = toc;
minutes = int32(floor(elapsedSeconds / 60));
seconds = elapsedSeconds - 60 * double(minutes);
message = sprintf('It is done compiling %s at %s. It took %d minutes and %.1f seconds.\n', mFileName, datestr(now), minutes, seconds);
fprintf('%s\n', message);
msgboxw(message);
For more information, here is the documentation link I got from Tech support:
This is the resource I mentioned that describes how to include a support package for compiled applications:
I hope this helps you get your compiled webcam application working. If it was helpful, then please click the Vote button up at the top of my Answer.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Compiler에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by