Webcam with App Designer
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi everyone!
I have an app that I have created in app designer in which I use the use of the web camera ... when I want to do packaging it marks an error and loads me the following files:
- Utility.p
- webcam.m
- webcaDataUtilityHelper.p
And the warning says : p-files cannot de analized for dependent files
댓글 수: 0
답변 (1개)
Jacob Mathew
2024년 2월 22일
I was able to replicate the error that you are facing and as I understand it is because of using P-code files in the project.
The error is due to P-code files being obfuscated code that cannot be analysed by the dependency analysis tool. Hence it is unable to automatically find and add the dependencies needed for the P-code file. To circumvent this, we need to add the dependencies manually when packaging the app.
The following example showcases the error. We create a parent function that calls a child function within it:
function out = parent
out = strcat("Hello ",child());
end
function out = child
out = "World";
end
Then we convert them into P-code using the pcode command in the command line:
pcode child
pcode parent
We then delete the parent and child function files so that we are left with only the P-code files. The output of calling the parent function will be a string “Hello World” which we will use inside our App Designer app to set as the text property for a Label using the Button’s Callback Function:
% The button's callback function
function ClicktoUpdateButtonPushed(app, event)
app.LabelText.Text = string(parent);
end
When we run the app, we see that the label’s text changes when we click the button:
When we go to package the app, we can now see the warning prompt in the GUI:
The workaround is to add the dependent files manually. In this case, we need to add child.p manually into our package. To do this, we click on Add files/folders under the Share resources and helper files to add our Child.p P-code file. The result should look as follows:
We can now go ahead and package the App without any errors. For more information about P-code refer to the following documentation:
댓글 수: 3
Walter Roberson
2024년 7월 17일
You do not know the dependent files of the p-code files.
Hypothetically, the implementation of the p-code files could be
try
dependency1()
catch ME
dependency2()
end
and it might be normal that dependency1() is not present (for example it might be a debugging interface)
So you could execute the code and observe what it crashes on, but you would have a difficult time proving that you got everything right.
Cesar Monroy Fonseca
2024년 7월 17일
I guess I will make my mind that this will take some time. I will procede as you suggest.
Best regards,
C.M.
참고 항목
카테고리
Help Center 및 File Exchange에서 National Instruments Frame Grabbers에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!