>> cList = {'United Kingdom','Bulgaria','Germany','Greece','Sweden','Netherlands','Spain','Romania','Luxembourg','Poland'};
[indx,tf] = listdlg('PromptString','Select 2 countries to study','ListString',cList);
>> indx
indx =
4 9
>> cList(indx)
ans =
1×2 cell array
{'Greece'} {'Luxembourg'}
>>
You just use the indices return to index into the list.
However, you can't control how many the user actually selects; it's either 'Single' or 'MultiSelect' on input and you only know how many the user selected when he returns.
You'll have to write code to test the size of the return array and decide how to handle the cases when user doesn't follow instructions.
Best Answer