How to change an image (icon) on button into another one image (icon) by clicking on this button in Matlab's App Designer?

16 ビュー (過去 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!

採用された回答

Mohammad Sami
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 ExchangeConvert Image Type についてさらに検索

タグ

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by