Info

此问题已关闭。 请重新打开它进行编辑或回答。

I need to reach datas on workspace

2 次查看(过去 30 天)
Emre Akinci
Emre Akinci 2019-6-3
关闭: MATLAB Answer Bot 2021-8-20
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 个评论
Rik
Rik 2019-6-5
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 2019-6-5
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);

回答(0 个)

此问题已关闭。

标签

产品


版本

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by