MATLAB: How to access the SelectionChangeFcn callback from the Property Inspector in MATLAB 7.4 (R2007a)

guideinspectorMATLABpropertyselectionchangefcnuibuttongroup

I am building a GUI using the GUIDE Layout Editor. I am trying to access the “SelectionChangeFcn” property for my uibuttongroup. However, this property is not available to edit in the Property Inspector window.

Best Answer

The ability to access and modify the "SelectionChangeFcn" property in the Property Inspector of GUIDE is not available in MATLAB.
The automatically generated callback function can be accessed by right-clicking on the Button Group panel and selecting "View Callbacks > SelectionChangeFcn".
If you would like to modify the SelectionChangeFcn, you will need to GET the property of the Button Group graphics object as follows:
get(H,'SelectionChangeFcn')
and similarly you can SET it by :
set(H, 'SelectionChangeFcn',<VALUE>);
where, H is the handle to the uibuttongroup and {VALUE} should be replaced by the MATLAB code or a handle to a function that you desire to be executed when the selection change occurs.