|
"Conrad Andrew" <conrad7@gmx.net> wrote in message <h61vft$b96$1@fred.mathworks.com>...
> Hi there
>
> I'd like to have a simple GUI where a number of checkboxes are placed programmatically. This number depends on user input so may vary. Let's say that on day 1, M may contain ['A1','A2'] but on day 2, it may have ['A1','A2','A3']. How do I generate a code that will place a number of checkboxes dependent on the size of M?
>
> Thanks very much for any help on this matter
numChk = inputdlg('Number of Check Boxes');
numChk = str2double(numChk);
uh = zeros(1,numChk);
for i = 1:numChk
uh(i) = uicontrol('Style','check');
if i > 1
pos = get(uh(i-1),'Position');
pos(2) = pos(2)+20;
set(uh(i),'Position',pos)
end
end
hth
Shaun
|