Webcam with App Designer

2 Ansichten (letzte 30 Tage)
Ana Victoria Barba
Ana Victoria Barba am 18 Okt. 2021
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

Antworten (1)

Jacob Mathew
Jacob Mathew am 22 Feb. 2024
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:
Design of the test app
% 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:
Screenshot of the app running
When we go to package the app, we can now see the warning prompt in the GUI:
Package MATLAB App GUI showing the warning about the P-Code file
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:
Manually adding the P-code file
We can now go ahead and package the App without any errors. For more information about P-code refer to the following documentation:
  3 Kommentare
Walter Roberson
Walter Roberson am 17 Jul. 2024
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
Cesar Monroy Fonseca am 17 Jul. 2024
Thank you very much, @Walter Roberson !
I guess I will make my mind that this will take some time. I will procede as you suggest.
Best regards,
C.M.

Melden Sie sich an, um zu kommentieren.

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by