Insert a PNG image on a table on App Designer

3 visualizaciones (últimos 30 días)
Iñigo Idigoras
Iñigo Idigoras el 24 de Mayo de 2022
Respondida: Abhishek Chakram el 3 de Oct. de 2023
I'm trying to insert a local PNG image on the 5 column of a table and I don't konw how to do it. I tryed to do it using an UI axes but I can´t insert that axes to the table.
% Button pushed function: B_AgregarImagen
function B_AgregarImagenButtonPushed(app, event)
global image1;
[filename pathname] = uigetfile({'".png'},"Open file");
fullpathname = strcat(pathname,filename);
image1 = imread(fullpathname);
imshow(image1,'parent',app.Tabla.Data(:,5));
end

Respuestas (1)

Abhishek Chakram
Abhishek Chakram el 3 de Oct. de 2023
Hi Iñigo Idigoras,
It is my understanding that you are facing difficulty in inserting image in the table in the App Designer. Here is a sample code on how to achieve this functionality:
[fileNames, filePath] = uigetfile('*.jpg', 'Select JPG files');
% Construct the full file path
fullFilePath = fullfile(filePath, fileNames);
% Read and display the image
image = imread(fullFilePath);
imgStyle = uistyle("Icon",image);
addStyle(app.UITable, imgStyle, 'cell', [1,1]);
In this example, the image is converted to an icon using ‘uistyle’ to display it in the “uitable” of the app.
You can refer to the following documentation to know more about the functions used:
Best Regards,
Abhishek Chakram

Categorías

Más información sobre Migrate GUIDE Apps 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!

Translated by