How to change an image (icon) on button into another one image (icon) by clicking on this button in Matlab's App Designer?
12 次查看(过去 30 天)
显示 更早的评论
Hi everyone,
This is necessary for the audio player for the play/pause button. For example, while the "play" button is pressed, an image (icon) appears on the pause button.
I don't understand how this can be added for a button. I can't find any decision to solve it. I need your help. Thank you for responce!
0 个评论
采纳的回答
Mohammad Sami
2020-5-21
You will need to do this in the callback of your button.
Assuming that when you create the button, you had set the text to Play and set the Icon file to play icon image.
function ButtonDownFcn(app,event)
switch app.Button.Text
case 'Play'
% do something to play
% change the text and icon
app.Button.Text = 'Pause';
app.Button.Icon = 'Pause.png'; % path to image file
case 'Pause'
% do something to pause
% change the text and icon
app.Button.Text = 'Play';
app.Button.Icon = 'Play.png'; % path to image file
end
end
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Convert Image Type 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!