Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

I need to reach datas on workspace

2 visualizzazioni (ultimi 30 giorni)
Emre Akinci
Emre Akinci il 3 Giu 2019
Chiuso: MATLAB Answer Bot il 20 Ago 2021
I have a listbox and I can add datas names to listbox and datas are sound files
I want to select an item on listbox and play it when I clicked a pushbutton.
  15 Commenti
Rik
Rik il 5 Giu 2019
You shouldn't be using evalin. You should probably be using one or more of these functions: uigetdir, dir, and uigetfile.
Emre Akinci
Emre Akinci il 5 Giu 2019
thanks Rik!
I am very happy with that.
How can I thank you? :D
There is my working codes
function listenButton_Callback(hObject, eventdata, handles)
audio = get(handles.listbox1,'String');
file = get(handles.listbox1, 'Value');
audio1 = audioread(audio{file});
sound(audio1,fs); % You can set fs by manual etc.:sound(audio1,44100);
function getFileButton_Callback(hObject, eventdata, handles)
% hObject handle to yenileButton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
sounds = uigetfile('*.wav','Choose one or more','MultiSelect', 'on');
set(handles.listbox1,'String',sounds);

Risposte (0)

Questa domanda è chiusa.

Tag

Prodotti


Release

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by