Info

This question is closed. Reopen it to edit or answer.

I need to reach datas on workspace

2 views (last 30 days)
Emre Akinci
Emre Akinci on 3 Jun 2019
Closed: MATLAB Answer Bot on 20 Aug 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 Comments
Rik
Rik on 5 Jun 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 on 5 Jun 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);

Answers (0)

This question is closed.

Tags

Products


Release

R2017a

Community Treasure Hunt

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

Start Hunting!