【发布时间】:2016-10-01 15:52:57
【问题描述】:
我有一个 Matlab GUI 列表框,它显示文件夹中的每个文件和一个按钮。如果我选择列表框中显示的文件之一并单击按钮,则该程序应该运行。 这是我的代码:
allfiles = dir; %get files
allname = {allfiles(~[allfiles.isdir]).name};
set(handles.wavlist, 'String', allname);
function wavlist_Callback(hObject, eventdata, handles)
filenames = get(hObject, 'String');
filechoice = get(hObject, 'Value');
fileselected = wavnames{filechoice};
function wavlist_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function tab1button_Callback(hObject, eventdata, handles)
[y, fs, nbits, opts] = wavread(fileselected);
但我收到错误未定义的函数或变量“文件选择”。任何想法?谢谢...
【问题讨论】:
-
如果以下答案对您有用,请告诉我们...
标签: matlab user-interface listbox