Creating a dropdown menu in inputdlg box

1.7k Views Asked by At

I have this Matlab code:

prompt = {'Enter period:','Enter frequency:'};
dlgtitle = 'Input';
dims = [1 35];
definput = {'3000','10'};
answer = inputdlg(prompt,dlgtitle,dims,definput)

I want to create a dropdown menu for period only with specific values. How can I do it?

1

There are 1 best solutions below

0
Robert Seifert On

inputdlg is not supposed to be manipulated. It blocks any interaction beyond the intended use. So there is no direct answer to your question.

You will have to write your own dialog box using uicontrol, which is quite easy to realize.

Alternatives:

You could copy and edit the original implementation in:

\toolbox\matlab\uitools\inputdlg.m

Although doing it from scratch would give you probably the fastest and cleanest solution.

Maybe the listdlg is even what you are looking for?

Depending on the number of options maybe even a questdlg is an option.