0
votes

I have the code below to assemble a dialog box:

prompt = {'Enter matrix size:','Enter colormap name:'};
title = 'Input';
dims = [1 35];
definput = {'20','Green'};
answer = inputdlg(prompt,title,dims,definput)

Basically I want to save in variables the inputs of the user like n=20 and color=Green. How to do that?

1
Have you looked at the variable answer after running your code? It should contain a 2x1 cell array with your inputs.beaker
yes but if i get the values with indexing parenthesis to answer it returns again cell array not a numbertheNewArtist
Then index the cell array using curly braces. It would help tremendously if you included the actual problem you're having in your question. There is no mention in your question of indexing with parentheses.beaker
Please read How to Ask.Cris Luengo

1 Answers

1
votes

please try:

n = str2num(answer{1});
color = answer{2};