Matlab sync data issue

Here’s the scenario: say I’m running an experiment, and have not yet started streaming data, but I am syncing data to matlab. If I then open a data stream, MWorks sets “sync” to 0, and clears the the currently cached data. I understand why you would want to clear the cache so that the data you’re seeing online matches the datafile, but I don’t understand why syncing is turned off.

  • Evan

Hi Evan,

This is (another) artifact of the event stream infrastructure. In short:

When the event file is opened, MWServer sends out a copy of the codec (the mapping from event codes to variable names) to ensure that it’s recorded in the event file. The MATLAB window sees the codec, assumes that a new experiment has been loaded, and resets itself.

As part of resetting itself, the MATLAB window sets the sync variable to 0. I think the reason for this is to maintain internal consistency: After reset, the window is in “not collecting data” mode, which corresponds to a value of 0 for sync.

While it’s not clear to me that anything bad would happen if we didn’t reset sync, the real issue here is that, in this case, the window shouldn’t be resetting itself at all, since the loaded experiment has not actually changed. Let me think about how we can prevent the reset from happening.

Chris

Hi Evan,

This issue is now fixed in the nightly build. The MATLAB window now checks each received codec against the previous one and resets itself only if they differ.

Cheers,
Chris