How to callback a pushbutton so code executes once pressed on GUIDE?
이전 댓글 표시
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)
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!