Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
change the drop-down menu list if a radio button is checked

Subject: change the drop-down menu list if a radio button is checked

From: Silin

Date: 11 Oct, 2012 19:25:08

Message: 1 of 3

Hi All,

I am designing a GUI that include a drop down menu for the user to select different calculation method they want. Currently I have 5 method names listed there. But now I want to add a radio button to toggle a different procedure - with that radio button checked on, the calculation method listed in the drop down menu will have to be changed to other string names. Any clue to do that?

I've tried something like:
if Rb_GME_Value
    set(handles.pm_Cal,'String',''--- Select --- ','Min', 'Base Offset'');
end

But the problem is then when I click the button the entire string of '--- Select --- Min Base Offset' will be listed in the first row. But actually what I want to see is something like this:
---- Select ----
Min
Base Offset

Thanks,

Subject: change the drop-down menu list if a radio button is checked

From: Sadik

Date: 11 Oct, 2012 22:45:09

Message: 2 of 3

Hi Silin,

You need a cell array of strings rather than a single string. So you can do the following [Only the quotes were replaced by curly braces]:

if Rb_GME_Value
    set(handles.pm_Cal,'String',{'--- Select --- ','Min', 'Base Offset'});
end

Best.

Subject: change the drop-down menu list if a radio button is checked

From: Silin

Date: 12 Oct, 2012 12:07:07

Message: 3 of 3

This works!
Thank you.


"Sadik " <sadik.hava@gmail.com> wrote in message <k57i5k$ela$1@newscl01ah.mathworks.com>...
> Hi Silin,
>
> You need a cell array of strings rather than a single string. So you can do the following [Only the quotes were replaced by curly braces]:
>
> if Rb_GME_Value
> set(handles.pm_Cal,'String',{'--- Select --- ','Min', 'Base Offset'});
> end
>
> Best.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us