Embedding images in GUI standalone executable
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi, I constructed a standalone executable file for a MATLAB GUI. The GUI contains images which I have called into the axes by using the code shown.
axes(handles.axes1);
imshow('C:\Users\asinha14\My Documents\MATLAB\DFIG\DFIG_PNG.png')
handles.output = hObject;
Further, while using the deploytool I have also added the image files in the 'Other files' section.
However, while running the 'exe' on any other computer, it gives an error message saying that the executable is unable to locate the path where the image is stored. May anyone guide about how I may 'embed' the images into the GUI exe while packaging or writing the code.
Thanking you for your time.
Anubhav
0 comentarios
Respuesta aceptada
Image Analyst
el 7 de Nov. de 2011
One way is to just install the images in a known folder on the target computer. You can include other files in the deployment package or do it manually. You can use deploytool, or another package such as InstallShield.
0 comentarios
Más respuestas (1)
Jan
el 7 de Nov. de 2011
You can create an M-file, which contains the image data. I've looked in the FEX, but cannot find a tool for this. Does anybody knows a submission for this task?
If there is really no solution yet, I'm going to publish one today.
[EDITED]: Parsing an M-file, which contains a [343x435x3 UINT8] array, needs more then 3 seconds on my computer. This is too slow. Using a base64 encoded string instead consumes 0.5 seconds only, but it should be much more efficient to use IMREAD or MAT-files with a known path (as suggested by Image Analyst). It should be possible to determine the installation folder and store the image or MAT file there.
3 comentarios
Jan
el 7 de Nov. de 2011
I've created a function, but found a massive problem: Parsing a large array in an M- or P-file needs a lot of time. My test data image has the size [343x435x3 UINT8]. This is written to an M-file: Img.cdata = [255, 2, 1, 2, 0, ...]. Reading this needs 3.1 seconds (Matlab 2009a/64, Core2Duo 2.3GHz, Win7). That's too slow to be useful except for small icons.
Therefore I've added a new suggestion, see [EDITED].
Image Analyst
el 7 de Nov. de 2011
The installation folder can be accessed in the code with the variable called ctfroot.
Ver también
Categorías
Más información sobre Introduction to Installation and Licensing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!