Webcam with App Designer
3 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Jacob Mathew
on 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:
% 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 Comments
Walter Roberson
on 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
on 17 Jul 2024
I guess I will make my mind that this will take some time. I will procede as you suggest.
Best regards,
C.M.
See Also
Categories
Find more on National Instruments Frame Grabbers in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!