How to call a function into a pushbutton GUI
Show older comments
Hello ,
I have a GUI with 3 buttons, and a list box.
I would like to update the listbox, when i press a button.
The listbox contents are mat files located in a specific folder.
Here the script of the listbox :
function listbox2_Callback(hObject, eventdata, handles) % hObject handle to listbox2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = cellstr(get(hObject,'String')) returns listbox2 contents as cell array % contents{get(hObject,'Value')} returns selected item from listbox2 handles.output = hObject; global files global A
set(handles.listbox2,'string',{files.name}); guidata(hObject, handles); contents = cellstr(get(hObject,'String')); %returns listbox1 contents as cell array A=contents{get(hObject,'Value')}
guidata(hObject,handles)
I would like to call this function into the push button
For the moment in pushbutton, i have :
function pushbutton2_Callback(hObject, eventdata, handles) % hObject handle to pushbutton2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
global files files = dir(fullfile(pwd,'manoeuvres','Calage_*')); guidata(hObject,handles)
I tried lot a command in order to launch it in the push button but i cant work
How can i manage to do that?
Thx for your reply
Accepted Answer
More Answers (0)
Categories
Find more on Whos in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!