listdlg, giving memory to list dialog from previous execution.

조회 수: 1 (최근 30일)
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

채택된 답변

Matt Tearle
Matt Tearle 2011년 3월 16일
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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Dialog Boxes에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by