Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Running a function in the background
Date: Tue, 17 Nov 2009 09:28:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 65
Message-ID: <hdtqb1$igb$1@fred.mathworks.com>
References: <f48e68c5-54f4-41b8-9843-0d8c995366b0@i4g2000prm.googlegroups.com> <43fc2ee2-059a-4a4f-8455-1adf0388a02d@w37g2000prg.googlegroups.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 1258450081 18955 172.30.248.35 (17 Nov 2009 09:28:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 17 Nov 2009 09:28:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1107115
Xref: news.mathworks.com comp.soft-sys.matlab:585713


swgillan <swgillan@gmail.com> wrote in message <43fc2ee2-059a-4a4f-8455-1adf0388a02d@w37g2000prg.googlegroups.com>...
> Thanks for sharing that, I have never used a lot of the gcf stuff, so
> I will look over that code and take what I can from it. I was also
> passed on the watch_malloc code from the presenter, so I should be
> able to figure out how things were done!
> 
> Thanks for all the help.
> 
> Now all I need is to find out why 3d plotting is messed up in Ubuntu
> 9.04 (I think it is an intel graphics driver problem).
> 
> Regards,
> 
> Steven Gillan
> >
> > If I were implementing something like that, I'd use a Timer object to
> > periodically run a function that updates the figure. ?As a small example:
> >
> > function comet2(delayS, x, y)
> > % COMET2 Display points in a line with a delay between each point display
> > %
> > % COMET2(delayS, x, y) displays each of the points represented by elements
> > % in the x and y vectors with a delay of delayS seconds between each point.
> >
> > if ~isequal(numel(x), numel(y))
> > ? ? error('comet2:invalidCoords', 'The x and y inputs must have the same
> > number of elements.');
> > end
> >
> > if ~isreal(delayS) || delayS <= 0 || ~isscalar(delayS) || ~isfinite(delayS)
> > ? ? error('comet2:invalidDelayS', 'The delay must be a real finite positive
> > scalar.');
> > end
> >
> > h = line(NaN, NaN);
> > axis([min(x) max(x) min(y) max(y)])
> > set(h, 'UserData', 1);
> >
> > t = timer('TasksToExecute', numel(x), ...
> > ? ? 'ExecutionMode', 'fixedRate', ...
> > ? ? 'StartDelay', 0, ...
> > ? ? 'Period', delayS);
> > set(t, 'TimerFcn', @(varargin) updatePlot(h, x, y, t), ...
> > ? ? 'StopFcn', @(varargin) delete(t));
> > start(t);
> >
> > function updatePlot(h, x, y, t)
> > try
> > ? ? nextPoint = get(h, 'UserData');
> > ? ? set(h, 'XData', x(1:nextPoint), 'YData', y(1:nextPoint), 'UserData',
> > nextPoint+1);
> > catch %#ok<CTCH>
> > ? ? stop(t);
> > end
> >
> > --
> > Steve Lord
> > sl...@mathworks.com
> > comp.soft-sys.matlab (CSSM) FAQ:http://matlabwiki.mathworks.com/MATLAB_FAQ

Hi

Could you please share what you have found so far? I am also trying to call some function via timer functions and in the background, but my GUI keeps getting locked for the time the m-file is running.

Best regards