Radio buttons without GUIDE

hi, i need to use radio buttons in my project.i've this code:
rd1 = uicontrol('style','radio',...
'units','pix',...
'position',[500 410 15 15],...
'string','',...
'callback',{@rd1_call});
function [] = rd1_call(src1){
f = make_subgui;
% error when it tries to execute the callback otherwise.
set(src,'deletefcn',{@fig_delet,f})}
i want to check the radio buttons but when it closes all the GUI's or stop the running program i want to un-check that, how can i do that?

답변 (1개)

Fangjun Jiang
Fangjun Jiang 2011년 9월 4일

0 개 추천

You can add that "un-check the radio buttons" command inside the CloseRequestFcn callback function.

댓글 수: 6

Nu9
Nu9 2011년 9월 4일
hi, first i want to block the check for one at time and then disable the check radio button after it runs the script
my 1st try:
%if (get(src,'Value') == get(src,'Max'))
% set(src,'Value','Min');
% pause(1);
%else
% set(src,'value','Max');
my 2nd try:
S=varargin{3};
R = [get(S.rd1(1),'val'), get(S.rd2(2),'val')]; % Get state of radios.
if R(1)==1 && R(2)==0
R(1)=0;
pause(2);
end
it doesn't work
Fangjun Jiang
Fangjun Jiang 2011년 9월 4일
Where did you put the above code? I don't understand what do you mean by get(src,'Max') and set(src,'Value', 'Min')
Nu9
Nu9 2011년 9월 4일
i put that code in the function of radio button, it gets always da 'Max' value when it's selected an Min when disable, i saw that in matlab help
Nu9
Nu9 2011년 9월 4일
now i'm using button group selection but i don't know how to use 'case' to do one thing in button 1 and another with button 2
i'm following this http://www.mathworks.com/help/techdoc/ref/uibuttongroup.html
Fangjun Jiang
Fangjun Jiang 2011년 9월 4일
Okay, then you need to use the SelectionChangeFcn callback. Search that on that page and follow the example.
Nu9
Nu9 2011년 9월 4일
it worked yeah, i can use now several cases into the SelectionChangeFcn callback, thanks

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Modeling에 대해 자세히 알아보기

질문:

Nu9
2011년 9월 2일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by