How to callback a pushbutton so code executes once pressed on GUIDE?
Show older comments
So I am having a problem trying to get the push button to execute when I click it once I select items from a listbox. Also, when I select an item from a listbox it executes immediately without waiting for the button press.
This is my code....
function cmp_list_Callback(hObject, eventdata, handles)
%other necessary data in between these lines
index_selected = get(hObject,'Value');
Materials = {ABS,Aluminum,Cardboard,HIPS,KAOWOOL,Kydex,PEI,PET,PMMA,POM};
for i =1:size(index_selected,2)
RMAT(i)=(Materials(index_selected(i))); %Selected info we want to show
end
FileName = uiputfile('*.cmp','Save as');
dlmwrite(FileName,RMAT,'');
function cmp_list_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
set(hObject,'String',{'ABS';'Aluminum';'Cardboard';'HIPS';'KAOWOOL';'Kydex';'PEI';'PET';'PMMA';'POM'});
function start1_Callback(hObject, eventdata, handles)
Accepted Answer
More Answers (0)
Categories
Find more on Interactive Control and Callbacks 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!