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

2 views (last 30 days)
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

MathWorks Support Team
MathWorks Support Team on 10 Nov 2025 at 0:00
Edited: MathWorks Support Team on 10 Nov 2025 at 11:58
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

Find more on Standalone Applications in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!