我目前正在matlab中编写一个指导用户界面(GUI),其中包含一个下拉菜单。
当选择下拉菜单的某个元素时,将打开包含列表框的第二个GUI。此列表框现在应显示第一个GUI提供的数据。
将数据传递到第二个GUI工作,我可以相应地更新句柄变量。但是我在使用传递的数据填充列表框时遇到问题,因为 listbox1_CreateFcn(hObject,eventdata,handles)中的句柄为空:
% --- Executes during object creation, after setting all properties.
%function listbox1_CreateFcn(hObject, eventdata, handles)
% hObject handle to listbox1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: listbox controls usually have a white background on Windows.
% See ISPC and COMPUTER.
set(hObject,'String', handles.stringData); % THIS LINE DOES NOT WORK,
% BECAUSE handles is empty
if ispc && isequal(get(hObject,'BackgroundColor'), get (0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
你知道我的问题的解决方案吗?
非常感谢, engineer.m