How to callback a pushbutton so code executes once pressed on GUIDE?
Afficher commentaires plus anciens
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)
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Interactive Control and Callbacks dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!