One approach:
lstprmt = {'Choose a variable'};
lstlist = {'x','y','z'};
choice1 = listdlg('PromptString',lstprmt, 'ListString',lstlist);
vrbl = lstlist{choice1}; % Variable Character
prompt = {'Enter Start Value','Enter End Value','Enter Step Value'};
dlg_title = 'Input Variables';
num_lines = 1;
def = {'','',''};
answer = inputdlg(prompt,dlg_title,num_lines,def);
start(choice1) = str2double(answer{1});
stop(choice1) = str2double(answer{2});
step(choice1) = str2double(answer{3});
This code uses the ‘choice1’ variable as an index into first the ‘lstlist’ cell array to store the chosen variable (if necesary), and then to use it as an array index for ‘start’ and the others. This way, the values are stored in an array, and in a position that can be used later with respect to each variable.
