Why is MATLAB Compiler not detecting the image dependency from "uiimage"?

I am trying to compile and deploy a simple application with an image using MATLAB Compiler in R2022b.
I use the code below to load the image named "questions.gif" in the app:
fig = uifigure;
im = uiimage(fig,"ImageSource","./questions.gif");
When I open the Application Compiler, it does not auto-detect the dependency on the image. However, when I use the following code, then the image is detected as a dependency of my application:
fig = uifigure;
imread('questions.gif');
im = uiimage(fig,"ImageSource","./questions.gif");
How can I add "question.gif" to the dependencies of my application without having to use "imread"?

 Accepted Answer

This is an intended behavior of MATLAB Compiler; very few functions, such as "imread" will autodetect the image "question.gif" as a dependency of the application; "uiimage" is not one of them.
To add "question.gif" to the dependencies of your application, please add the image manually in the "File required for your application to run" section of the "Application Compiler App," as shown on the following help page:
Alternatively, you can use the "-a" flag of the MCC command as shown on the help page below:

More Answers (0)

Categories

Products

Release

R2022b

Community Treasure Hunt

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

Start Hunting!