- uistyle: https://www.mathworks.com/help/matlab/ref/uistyle.html
- addStyle: https://www.mathworks.com/help/matlab/ref/matlab.ui.control.table.addstyle.html
Insert a PNG image on a table on App Designer
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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
0 Commenti
Risposte (1)
Abhishek Chakram
il 3 Ott 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
0 Commenti
Vedere anche
Categorie
Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!