The callback of an ui element is called whenever the element has been modified. However this does not necessarily mean that the value of the element has changed.
Here is an example where an action is only performed if the value has changed. The trick is to use a value variable with persistent
.
function popupmenuAlgorithm_Callback(hObject, eventdata, handles) % hObject handle to popupmenuAlgorithm (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) persistent lastValue; if (lastValue ~= get(hObject,'Value')) handles.('status').('doCalibrationUpdate') = true; end lastValue = get(hObject,'Value'); |