Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: I have a question about gui
Date: Thu, 27 Nov 2008 09:47:02 +0000 (UTC)
Organization: PhysioSonics Inc
Lines: 30
Message-ID: <gglqam$1c0$1@fred.mathworks.com>
References: <ggjvea$sfi$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1227779222 1408 172.30.248.37 (27 Nov 2008 09:47:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 27 Nov 2008 09:47:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1129061
Xref: news.mathworks.com comp.soft-sys.matlab:503476


"JJ JJ" <JJham2142@gmail.com> wrote in message <ggjvea$sfi$1@fred.mathworks.com>...
> Hi 
> 
> I want to make a simple gravity simulation.
> 
> It's very simple.
> 
> If  input weight(text field) and press add button,
> 
> object is made and drop down by gravity.
> 
> 
> The problem is here.
> 
> When one object already dropping, I add another object,
> 
> second object doesn't move until first object reaches ground.
> 
> I think, I make function move() and
> 
> function move() returns immediately from the function call.
> 
> but, how can I exactly do that ?
> 
> I want to make many object and drop down at the same time.
> 

I have done animations like this using Timer functions.  I assume you have a FOR loop running in move().  There is no way to make the MATLAB function move() return before it completes.

If you use a timer object, at each execution of the callback you can have a set of conditionals that creates and destroys objects, and increments the position of objects.  One option is to store the data in UserData of the Timer function, so that it is accessible and can be updated on each invokation of the callback.