- 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
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Abhishek Chakram
2023-10-3
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!