From: viji sai on
i have created a button group with four radio buttons and a push button using guide.

four functions for each radio button written separately.

1.how to call these functions to respective radio buttons.
2.when the push button is pressed, corresponding radio button's function which has been checked should execute.
kindly help me to write a program for this.

thanks

vs
From: Walter Roberson on
viji sai wrote:
> i have created a button group with four radio buttons and a push button
> using guide.
> four functions for each radio button written separately.
>
> 1.how to call these functions to respective radio buttons.
> 2.when the push button is pressed, corresponding radio button's function
> which has been checked should execute.
> kindly help me to write a program for this.

The individual buttons for a uibuttongroup are hidden children of the uipanel
whose handle is returned when the uibuttongroup is created. Hidden in the
sense that their HandleVisibility property is off. allchild() of the handle
returned by the uibuttongroup . The order in the children will be returned in
is the opposite of the order they were added to the group.

Do _not_, however, directly change the Callback property of an individual
button, as uibottongroup will have set the Callback to a function that manages
the group as a whole, deselecting any current selection and selecting the
current one.

Instead, what you should do is set up a SelectionChangeFcn for the
uibuttongroup . Inside the SelectionChangeFcn callback, the evt parameter will
have a field named OldValue which will be the handle of what was previously
selected, and a field named NewValue which will be the handle of what was just
selected.

For a specific programming example, see

http://www.mathworks.com/access/helpdesk/help/techdoc/creating_guis/f10-998412.html#brrll58-1
From: viji sai on
Thank you. i have solved it. the link was very useful.

Walter Roberson <roberson(a)hushmail.com> wrote in message <hq0247$est$1(a)canopus.cc.umanitoba.ca>...
> viji sai wrote:
> > i have created a button group with four radio buttons and a push button
> > using guide.
> > four functions for each radio button written separately.
> >
> > 1.how to call these functions to respective radio buttons.
> > 2.when the push button is pressed, corresponding radio button's function
> > which has been checked should execute.
> > kindly help me to write a program for this.
>
> The individual buttons for a uibuttongroup are hidden children of the uipanel
> whose handle is returned when the uibuttongroup is created. Hidden in the
> sense that their HandleVisibility property is off. allchild() of the handle
> returned by the uibuttongroup . The order in the children will be returned in
> is the opposite of the order they were added to the group.
>
> Do _not_, however, directly change the Callback property of an individual
> button, as uibottongroup will have set the Callback to a function that manages
> the group as a whole, deselecting any current selection and selecting the
> current one.
>
> Instead, what you should do is set up a SelectionChangeFcn for the
> uibuttongroup . Inside the SelectionChangeFcn callback, the evt parameter will
> have a field named OldValue which will be the handle of what was previously
> selected, and a field named NewValue which will be the handle of what was just
> selected.
>
> For a specific programming example, see
>
> http://www.mathworks.com/access/helpdesk/help/techdoc/creating_guis/f10-998412.html#brrll58-1
From: viji sai on
thank you very much.
with your help, i am now able to call the function for each radio button. however, i get a error message

Reference to non-existent field 'ics_si'

ics_si is my function, which has the following code, i do not know where i am making a mistake

i have created the edit box for user to input the values for bore and stroke. and vdisp is calculated and the result is displayed in the third edit box.

function ics_si_Callback(hObject, eventdata, handles)

b = str2double(get(handles.bore,'String'));
s = str2double(get(handles.stroke,'String'));
vdisp = (pi * b * b * s*10^(-3))/4;
set(handles.vdisp,'String',vdisp);


this code must be called when i press the first or second radio button. i.e. when the radio button is pressed, it should call the function ics_si, calculate it and display the result.
how to get this.


Walter Roberson <roberson(a)hushmail.com> wrote in message <hq0247$est$1(a)canopus.cc.umanitoba.ca>...
> viji sai wrote:
> > i have created a button group with four radio buttons and a push button
> > using guide.
> > four functions for each radio button written separately.
> >
> > 1.how to call these functions to respective radio buttons.
> > 2.when the push button is pressed, corresponding radio button's function
> > which has been checked should execute.
> > kindly help me to write a program for this.
>
> The individual buttons for a uibuttongroup are hidden children of the uipanel
> whose handle is returned when the uibuttongroup is created. Hidden in the
> sense that their HandleVisibility property is off. allchild() of the handle
> returned by the uibuttongroup . The order in the children will be returned in
> is the opposite of the order they were added to the group.
>
> Do _not_, however, directly change the Callback property of an individual
> button, as uibottongroup will have set the Callback to a function that manages
> the group as a whole, deselecting any current selection and selecting the
> current one.
>
> Instead, what you should do is set up a SelectionChangeFcn for the
> uibuttongroup . Inside the SelectionChangeFcn callback, the evt parameter will
> have a field named OldValue which will be the handle of what was previously
> selected, and a field named NewValue which will be the handle of what was just
> selected.
>
> For a specific programming example, see
>
> http://www.mathworks.com/access/helpdesk/help/techdoc/creating_guis/f10-998412.html#brrll58-1