Thread Subject: evalin working in debug but not in run time

Subject: evalin working in debug but not in run time

From: Andy

Date: 7 Jul, 2009 07:30:05

Message: 1 of 4

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.

Subject: evalin working in debug but not in run time

From: Mike Karr

Date: 28 Jul, 2009 11:56:56

Message: 2 of 4

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

Subject: evalin working in debug but not in run time

From: Andy

Date: 28 Jul, 2009 13:07:02

Message: 3 of 4

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

Subject: evalin working in debug but not in run time

From: Andy

Date: 29 Jul, 2009 09:24:01

Message: 4 of 4

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

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
evalin Andy 7 Jul, 2009 03:34:03
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com