Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Christmas Gimmick - random numbers
Date: Wed, 12 Dec 2012 21:04:09 +0000 (UTC)
Organization: Mitre Corp
Lines: 74
Message-ID: <kaarg9$c18$1@newscl01ah.mathworks.com>
References: <ka4a8k$gju$1@newscl01ah.mathworks.com> <ka4oi3$3hu$1@newscl01ah.mathworks.com> <kaa460$a0d$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-03-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1355346249 12328 172.30.248.48 (12 Dec 2012 21:04:09 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 12 Dec 2012 21:04:09 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2318
Xref: news.mathworks.com comp.soft-sys.matlab:784699

"Ulrik Nash" <uwn@sam.sdu.dk> wrote in message <kaa460$a0d$1@newscl01ah.mathworks.com>...
> "Ulrik Nash" <uwn@sam.sdu.dk> wrote in message <ka4oi3$3hu$1@newscl01ah.mathworks.com>...
> > "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
> 
> No help at hand? I would really appreciate it if someone would demonstrate how to place the background image.

Since no one else has answered, I'll take a stab at it.  

I tried running your code but I get an error when it gets to the line:
men_number_1 = men(1,select_men_ids(1,1));
(Men is an undefined function - I believe the same will happen for women.)

If I understand what you are asking, I don't believe there is a way to put a background image on a static text uicontrol.  Unless there is a "low-level" way to do it in java that I'm not aware of.   I believe you can do it with push or toggle buttons using the CData property.

If I understand your code above, there is nothing special about using a static text uicontrol.  Why not display your background using the IMAGE command:

doc image

(see Example 2) and use the TITLE command to display the text.  
Or display the man/woman numbers on the resulting axes object using the TEXT command:

doc text