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!

 Respuesta aceptada

Kevin Phung
Kevin Phung el 28 de Mzo. de 2019

1 voto

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
'String','Enter',...
'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
disp('hello')
end

2 comentarios

Ana Campos
Ana Campos el 28 de Mzo. de 2019
Thanks very much! I'll try it :)
Kevin Phung
Kevin Phung el 28 de Mzo. de 2019
happy to help, let me know if you have any more questions

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Audio I/O and Waveform Generation en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 28 de Mzo. de 2019

Comentada:

el 28 de Mzo. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by