displaying contents in a list bx after button press
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi I have a GUI, in which i press a button and it obtains all he file names from my database. I then want this to be displayed within a list box but can't get the list box to update can someone help please?
here is my code so far:
% --- Executes on button press in pushbutton7.
function pushbutton7_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global str;
str = getfilenames;
disp(str);
% --- 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.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
global str;
set(hObject, 'String', str2 );
0 Kommentare
Akzeptierte Antwort
Azzi Abdelmalek
am 18 Aug. 2013
Your code is not clear for me, but I see that you are creating a list in the listbox callback while you should do it in the push button callback
2 Kommentare
Azzi Abdelmalek
am 18 Aug. 2013
Bearbeitet: Azzi Abdelmalek
am 18 Aug. 2013
Use
function pushbutton7_Callback(hObject, eventdata, handles)
str = getfilenames;
set(handles.listbox1, 'String', str );
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Database Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!