How to create a dialog with multiple fields by using inputdlg on Mac?

14 views (last 30 days)
It is the very first time I use Matlab on Mac. I am using Matlab R2013a on a Mac OSX 10.8.5.
I can create a simple dialog, with only one field, but I was not able to create a dialog with mutiple lines. I tried with my own programs but also with small toy examples I found in the tutorials.
For example:
I can run this:
if true
x = inputdlg('My single field dialog','dialog',1,'my single value');
But I can not run this:
if true
x = inputdlg({'field-1','field-2'},'dialog',1,{'value1','value2'});
I get the following error message:
Error using inputdlg (line 53) This function only accepts strings as its first parameter.
I can run inputdlg without any problem in my Linux machine.
Any help would be much appreciated!
Best regards

Accepted Answer

Robert Cumming
Robert Cumming on 28 Nov 2014
on your MAC try:
which -all inputdlg
to check that you haven't got a function name clash anywhere...
What is line 53 in the inputdlg function?
  1 Comment
Charles on 28 Nov 2014
Edited: Image Analyst on 28 Nov 2014
That was an amazing suggestion!!!
I did what you suggested and I realized that I had 2 different inputdlg installed. The "original" one, and another version within a plugin folder (plugin HERMES - ). Like this:
I just removed the folder of this plugin from my PATH and my example ran perfectly! So, the 'inputdlg' function within HERMES plugin was different from the original one.
Thank you very much for your help!
Best regards,

Sign in to comment.

More Answers (1)

Image Analyst
Image Analyst on 27 Nov 2014
Did you look in the help and notice how they did it:
prompt = {'Enter matrix size:','Enter colormap name:'};
dlg_title = 'Input';
num_lines = 1;
def = {'20','hsv'};
answer = inputdlg(prompt,dlg_title,num_lines,def);
I'm sure you'll be able to adapt this with no problem.
Charles on 28 Nov 2014
Thank you again for your reply.
Yes, I am sure it is exactly the example I ran. As I told before, this example works fine in my Matlab in Linux (Debian 3.10, Matlab R2011b), but doesn't work in my Mac version (Mac OSX 10.8.5, Matlab R2013a). Because of this I thought it could have some special settings for Mac.
I also thought it could be a problem with the array of strings.
Are you also running in a Mac OS X machine?
Thanks for the suggestion to call Mathworks. I will think about this.

Sign in to comment.


Find more on Environment and Settings in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by