I found the solution !
This is what you can do :
[x,map]=imread('All_Logos.png'); % Read image and store it in x
I2=imresize(x, [100 113]); % Resize image (Just an option)
% Create pushbuttons
leftButton = uicontrol(buttonPanelLeft, 'Style', 'pushbutton', ...
'String', 'Add New Capacitor', 'Units', 'normalized', 'Position', [0 0 1 1], ...
'Callback', @(src, event) buttonPressCallback('A'),'cdata',I2); % Use cdata to affect the
% The image data stored in I2
Done !
2 Comments
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/599782-show-image-in-button-using-code#comment_1024255
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/599782-show-image-in-button-using-code#comment_1024255
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/599782-show-image-in-button-using-code#comment_1024282
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/599782-show-image-in-button-using-code#comment_1024282
Sign in to comment.