Insert a PNG image on a table on App Designer

4 vues (au cours des 30 derniers jours)
Iñigo Idigoras
Iñigo Idigoras le 24 Mai 2022
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

Réponses (1)

Abhishek Chakram
Abhishek Chakram le 3 Oct 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

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by