Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: evalin working in debug but not in run time
Date: Wed, 29 Jul 2009 09:24:01 +0000 (UTC)
Organization: Algorithmic Media Ltd
Lines: 44
Message-ID: <h4p4fh$3mo$1@fred.mathworks.com>
References: <h2uths$p3o$1@fred.mathworks.com> <h4mp28$e53$1@fred.mathworks.com> <h4mt5m$jru$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 1248859441 3800 172.30.248.37 (29 Jul 2009 09:24:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 29 Jul 2009 09:24:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1835236
Xref: news.mathworks.com comp.soft-sys.matlab:559227


Update: rather mysterious - it seems to be a timing issue. If I insert:

pause(0.2)

immediately before

ts1=evalin('base', 'OHLC');

the code executes perfectly. Interestingly, values for pause below 0.2 are unreliable - sometimes work, sometimes not.

It seems that without the pause(0.2) line evalin reads a stale value of 'OHLC' from somewhere. Quite where it gets it from I haven't a clue as I explicitly clear OHLC and ts1 between calls elsewhere in the code.
 


"Andy " <andy.webb@deletethis.xxx.omegaderivatives.com> wrote in message <h4mt5m$jru$1@fred.mathworks.com>...
> Thanks Mike - no not resolved - tech support seem to think there is a genuine problem. I'll file a bug report. A
> 
> 
> Mike Karr <mkarr@mathworks.com> wrote in message <h4mp28$e53$1@fred.mathworks.com>...
> > Andy wrote:
> > > Hi
> > > 
> > > I have a GUI that plots market data as candlestick chart. When the user populates the list box fields next to the chart and clicks a command button, a connection to a thrid party market data application is opened and the data is collected. For various reasons to do with the way the .m files for connecting and getting this data work, I am assigning the resulting four column matrix of data to the base workspace. This all works fine and I can see the correctly sized variable containing the correct data in the base workspace.
> > > 
> > > I then need to get this data into the workspace of the .m file for the GUI, which I have done by putting the following line in that .m file:
> > > 
> > > ts1=evalin('base', 'OHLC');
> > > 
> > > If I put a break point on that line and run in debug mode, the code executes perfectly - 'OHLC' is assigned to 'ts1' correctly and the rest of the code that plots the chart also functions correctly.
> > > 
> > > However at run time evalin does not work. The code executes without throwing errors but the variable in the base workspace is not copied to ts1. The chart plots the data previously requested. (E.g. if the new request is for 100 bars of data and the previous request was for 50, if plots the 50 bars, not the 100)
> > > 
> > > Bizarrely, if the user clicks the command button in the GUI twice then the correct data plots OK. 
> > > 
> > > I have tried putting a breakpoint on the line below the one above. When execution halts there I can see that 'OHLC' in the base workspace is correct, but 'ts1' has stale values. Apart from anything else I can't think where it is getting those values from, as I have put 'clear ts1' near the end of the function.
> > > 
> > > Any suggestions very gratefully received.
> > 
> > If this problem is not resolved, we would appreciate it if you would 
> > file a bug report,
> > providing enough files and instructions to reproduce the problem.
> > 
> > apologies for the late response and for the difficulties,
> > mike