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!