listdlg, giving memory to list dialog from previous execution.

1 view (last 30 days)
Hi,
I am using a list dialog in my code, allowing user to select the desired items. I want to introduce some kind of memory to the list dialog so that it remember the previously selected items.
Right now i am using following code for the list dialog. For example
r = {'Crunchy','Creamy','Natural','Chocolate'};
[Selection,ok] = listdlg('ListString',r);
for i = 1 : length(Selection)
some operation...
end
In above example if user has selected Crunchy and Creamy Then i want that next time "Crunchy" and "Creamy" should be pre-selected in the list dialog.
Thanks in advance for your suggestions, tips and hints.
Kind regards, \\ Arsalan

Accepted Answer

Matt Tearle
Matt Tearle on 16 Mar 2011
Will this do what you want?
r = {'Crunchy','Creamy','Natural','Chocolate'};
Selection=[];
for k=1:3
[Selection,ok] = listdlg('ListString',r,'InitialValue',Selection);
% Do more stuff
end

More Answers (0)

Community Treasure Hunt

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

Start Hunting!