Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: I have a question about gui
Date: Wed, 3 Dec 2008 06:47:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 84
Message-ID: <gh5a15$mfo$1@fred.mathworks.com>
References: <ggjvea$sfi$1@fred.mathworks.com> <gglqam$1c0$1@fred.mathworks.com> <ggtn24$44i$1@fred.mathworks.com> <ggtqv6$nbi$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1228286821 23032 172.30.248.35 (3 Dec 2008 06:47:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 3 Dec 2008 06:47:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1618672
Xref: news.mathworks.com comp.soft-sys.matlab:504595


"Ryan Ollos" <ryano@physiosonics.com> wrote in message <ggtqv6$nbi$1@fred.mathworks.com>...
> "J.J. hamin" <JJham2142@gmail.com> wrote in message <ggtn24$44i$1@fred.mathworks.com>...
> > Very Very Thanks for your answer.
> > 
> > It's helpful!
> > 
> > but, I can't make program in a concrete way.
> > 
> > So, Could you sent me a example source code that was mentioned your answer?
> > 
> > my email is JJham2142@gmail.com
> 
> 
> function hOut = moveObjectWithTimer
> % This function randomly creates 'dots' and moves them across the screen
> 
> global h
> 
> h.figure = figure;
> 
> h.axes = axes('XLim', [0 10], ...
>     'YLim', [0 10]);   
> 
> h.line = [];
> 
> h.timer = timer('ExecutionMode', 'fixedrate', ...
>     'Period', 1, ...
>     'TimerFcn', @moveObject);
> 
> start(h.timer);
> 
> hOut = h;
> 
> function moveObject(tObj, eventdata)
> 
> global h
> 
> % Move objects
> for i=1:length(h.line)
>     XData = get(h.line(i), 'XData');
>     YData = get(h.line(i), 'YData');    
>     XData = XData - 1;
>     YData = YData - 1;
>     set(h.line(i), 'XData', XData, ...
>         'YData', YData);
> end
> 
> % Randomly create a new object, on average every nPeriods
> nPeriods = 5;
> r = randi(nPeriods, 1);
> if r == 1
>     hObj = createObject;
>     h.line = [h.line hObj];
> end
> 
> % Delete objects that have reached lhs of axes
> hLineTemp = h.line;
> for i=1:length(h.line)
>     XData = get(h.line(i), 'XData');
>     YData = get(h.line(i), 'YData');    
>     if XData==-1 && YData==-1
>         delete(hLineTemp(i))
>         hLineTemp(i)=[];
>     end
> end
> h.line = hLineTemp;
> 
> 
> function hObj = createObject
> 
> global h
> 
> hObj = line('Parent', h.axes, ...
>     'XData', 10, ...
>     'YData', 10, ...
>     'Marker', 'o', ...
>     'MarkerFaceColor', [0 0 0], ...
>     'LineStyle', 'none');
>         
> % [EOF]



THANKS !!