Path: news.mathworks.com!not-for-mail
From: "Ulrik Nash" <uwn@sam.sdu.dk>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Christmas Gimmick - random numbers
Date: Mon, 10 Dec 2012 13:37:07 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 53
Message-ID: <ka4oi3$3hu$1@newscl01ah.mathworks.com>
References: <ka4a8k$gju$1@newscl01ah.mathworks.com>
Reply-To: "Ulrik Nash" <uwn@sam.sdu.dk>
NNTP-Posting-Host: www-06-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1355146627 3646 172.30.248.38 (10 Dec 2012 13:37:07 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 10 Dec 2012 13:37:07 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2106050
Xref: news.mathworks.com comp.soft-sys.matlab:784535

"Ulrik Nash" <uwn@sam.sdu.dk> wrote in message <ka4a8k$gju$1@newscl01ah.mathworks.com>...
> Hi Everyone,
> 
> My department's Christmas party is coming up, and I have the duties for seating arrangements. To make people mix and mingle a little more than usual, I wish to create a simple program, which draws two numbers at random from a list of participants, every X minutes. This will prompt the two corresponding participants to swap seats (actually, they will meet at the front of the dining hall, pour a glass of snaps, say cheers, and then swap seats!). 
> 
> My questions is, can this be done using MATLAB? Ideally the numbers should be shown on a Christmas image background.
> 
> I really appreciate your help/advice.

Okay, so far so good. I would really appreciate if someone could tell me how to implement a background image.

for i = 1:N
% Display area
display_area = uicontrol('Style','text','Position',[0 0 500 400]);

% Static text:
man_text={'Would these MEN please come to the front, propose a toast, and then change seats!'};
static_men = uicontrol('Style','text','Position',[0 350 500 25]);
set(static_men,'String',man_text);

woman_text={'Would these WOMEN please come to the front, propose a toast, and then change seats!'};
static_women = uicontrol('Style','text','Position',[0 150 500 25]);
set(static_women,'String',woman_text);

% Location of display for men 
man_1 = uicontrol('Style','text','Position',[0 325 500 25]);
man_2 = uicontrol('Style','text','Position',[0 300 500 25]);

% Location of display for momen 
woman_1 = uicontrol('Style','text','Position',[0 125 500 25]);
woman_2 = uicontrol('Style','text','Position',[0 100 500 25]);

% Select two men to swap seats
select_men_ids = randperm(10);
men_number_1 = men(1,select_men_ids(1,1));
men_number_2 = men(1,select_men_ids(1,2));

% Select two women to swap seats
select_women_ids = randperm(10);
women_number_1 = women(1,select_women_ids(1,1));
women_number_2 = women(1,select_women_ids(1,2));

% Display numbers
set(man_1,'String',num2str(men_number_1));  % Displays 3 lines, one number per line
set(man_2,'String',num2str(men_number_2));  % Displays 3 lines, one number per line

% Display numbers
set(woman_1,'String',num2str(women_number_1));  % Displays 3 lines, one number per line
set(woman_2,'String',num2str(women_number_2));  % Displays 3 lines, one number per line

pause(number_of_seconds_between_swaps)

end