MATLAB Answers


UI push buttons play audio

Ana Campos さんによって質問されました 2019 年 3 月 28 日
最新アクティビティ Kevin Phung
さんによって コメントされました 2019 年 3 月 28 日
Hello, I need to build a UI with 3 push buttons and each one of them needs to play an audio file. I am not used to working with UI and the code that I would use within a script doesn't work for the UI. Any tips on how to do it please? :) Cheers!

  0 件のコメント

サインイン to comment.


1 件の回答

Kevin Phung
回答者: Kevin Phung
2019 年 3 月 28 日

if you want to create your ui programmatically, check this out:
if you want to use matlabs appdesigner, which is actually pretty nice but you dont have complete control:
I prefer programming the ui myself.
so for example to create a pushbutton:
%in a script:
f = figure;
push1 = uicontrol('Style','pushbutton',... %type of uicontrol
'callback',@push1callback); %run this function when triggered / pushed
push1 %call this to see other properties you can adjust.
%create a function for the pushbutton:
function push1callback(hObj,event) %always include these 2 parameters, they are there by default

  2 件のコメント

Ana Campos 2019 年 3 月 28 日
Thanks very much! I'll try it :)
Kevin Phung
2019 年 3 月 28 日
happy to help, let me know if you have any more questions

サインイン to comment.

Translated by