MATLAB Answers

Multiple prompt/input with inputdlg according to a value

25 views (last 30 days)
Gonzalo Molina
Gonzalo Molina on 5 Jun 2020 at 12:19
Commented: dpb on 5 Jun 2020 at 16:33
Hi everybody, I am at the "visual" stage of my program and I want to simplify the input process.
The program works with a variable amount of colors which changes depending on the image that is analyzed.
After that, the user must introduce manually two treshhold values MIN/MAX for each color.
I would like to use inputdlg() to display as much prompt/inputs as needed according to the "colors" value.
Here a self made image of what I would like to have:
Thank you in advance.

  5 Comments

Show 2 older comments
madhan ravi
madhan ravi on 5 Jun 2020 at 14:38
Yes I was interpreting in another way xD. Nevertheless I admire the terms you use often.
dpb
dpb on 5 Jun 2020 at 16:33
OK...just in case you didn't realize there was one in the arsenal... :)
"I admire the terms you use often."
Indeed, I don't see any point in not having a little fun and humor along the way! Glad somebody sees similarly.

Sign in to comment.

Accepted Answer

Ameer Hamza
Ameer Hamza on 5 Jun 2020 at 13:04
Something like this
num_colors = 4;
prompts = cell(1, num_colors*2);
prompts(1:2:end) = compose('Enter min value for color %d', 1:num_colors);
prompts(2:2:end) = compose('Enter max value for color %d', 1:num_colors);
out = inputdlg(prompts)

  1 Comment

Gonzalo Molina
Gonzalo Molina on 5 Jun 2020 at 14:44
Hello again Ameer, it was really useful.
Here is what I've done to display a dialog for each one.
for i= 1:colors
prompt2 = compose('Enter MIN value for color %d', i);
content_coords(i,4) = eval(char(inputdlg(prompt2,dlgtitle1,dims1,definput)));
prompt3 = compose('Enter MAX value for color %d', i);
content_coords(i,5) = eval(char(inputdlg(prompt3,dlgtitle1,dims1,definput)));
end
Thank you.

Sign in to comment.

More Answers (0)

Tags