Communicating with NetStation

Hi all,

We've had a couple of problems with getting Matlab and EGI NetStation to communicate for quite some time now but were able to solve most of them.
We are now trying to send event codes from Matlab 2016a to NetStation 5.2.0.1, using the Psychtoolbox NetStation commands.  

The code we are using is as follows:

[status, error] = NetStation('Connect','10.10.10.42','55513’); % 10.10.10.42 = IP address of Mac, where NetStation is installed
NetStation('StartRecording’)
NetStation('Event',’555’)

When we run these commands, status = 0.  We receive an error when Matlab attempts to execute ‘NetStation(‘Event’,’555’).  The error is:
‘Undefined function or variable ‘status’.  Error in NetStation (line 280) error=nserr(status);’

We would be very grateful for any advice as to how to address this error.  Please could you advise us as to what could be going wrong?


Thank you & best wishes!

Dear Meike,

I am forwarding my e-mail to the list from a couple of months ago in which I report on our fare with the EGI-system/NetStation software. Maybe some of the information in there is helpful to address your issue. Let me know.
[There were other e-mails in response to mine with more advice - you might want to search the archives for them.]

Kind regards,
Urte

*****
Von: "Urte Roeber U.Roeber@... [PSYCHTOOLBOX]" <PSYCHTOOLBOX@yahoogroups.com>
Betreff: Aw: [PSYCHTOOLBOX] triggers to EGI's NetStation (was: NS5.2 compatibility)
Datum: 14 Jul 2016 15:19:03 GMT+8

Dear all,


Here is an update on my progress (success if you wish) to send triggers to EGI’s NetStation Acquisition software.
I am grateful to Nick for valuable advice and a testing script and to the EGI support team who also supplied me with a testing script.

I had to upgrade the Mac that runs EGI’s NetStation software to Mac OS X Yosemite (10.10.5) in order to upgrade to NetStation 5.2. (This was interesting, because we just got the system from EGI as „ready to use“). [Apparently, there is a new upgrade available to NetStation 5.3 that runs on Mac’s latest OS X El Capitan].

After the update I have been able to send triggers, BUT I have to call 

NetStation('Synchronize‘,[someTimeInMS]);

every 60 seconds or so, otherwise the clocks from the experiment computer and the amplifier would drift too far apart.
Apparently ‚someTimeInMS‘ needs to be at least twice the default value of 2.5 ms, otherwise the call will return a synchronization failure.

The other issue that I was having is, that the call to

NetStation('Event' [,code] [,starttime] [,duration] [,keycode1] [,keyvalue1] [...])

only worked when I defined at least one keycode1 / keyvalue1 pair, otherwise the script would stall and not send a trigger.

Here is a minimal script, that works for me:

%%%%%
netStationHostName = '10.10.10.42’; %this is the Mac’s IP address

[status, error] = NetStation('Connect',netStationHostName);
 
NetStation('Synchronize',10);

WaitSecs(.5);

for itrial = 1:10
NetStation('event','stim’, GetSecs, 0.001, ’trln’, itrial);
WaitSecs(.5);
end
%%%%%

I am using PsychToolbox Version 3.0.12 (which I will update as soon as our current experiments are finished) with Matlab R2014b on Linux Mint 17.1.

Kind regards,
Urte


Am 08 Sep 2016 um 20:11 schrieb meike.scheller@... [PSYCHTOOLBOX] <PSYCHTOOLBOX@yahoogroups.com>:


Hi all,

We've had a couple of problems with getting Matlab and EGI NetStation to communicate for quite some time now but were able to solve most of them.
We are now trying to send event codes from Matlab 2016a to NetStation 5.2.0.1, using the Psychtoolbox NetStation commands.  

The code we are using is as follows:

[status, error] = NetStation('Connect','10.10.10.42','55513’); % 10.10.10.42 = IP address of Mac, where NetStation is installed
NetStation('StartRecording’)
NetStation('Event',’555’)

When we run these commands, status = 0.  We receive an error when Matlab attempts to execute ‘NetStation(‘Event’,’555’).  The error is:
‘Undefined function or variable ‘status’.  Error in NetStation (line 280) error=nserr(status);’

We would be very grateful for any advice as to how to address this error.  Please could you advise us as to what could be going wrong?


Thank you & best wishes!



--------------------------------
Urte Roeber, PD Dr. rer. nat. habil. Dipl.-Psych.
Senior Lecturer
School of Psychology and Exercise Science
Murdoch University
90 South Street
Murdoch WA 6150, Australia

E-mail: u.roeber@...
Phone: +61 8 9360 2988
Location: Social Sciences (440) 2.026


The content of this e-mail is intended for the addressee only and may not be forwarded to a third party without my written permission.
--------------------------------







Ok, this seems to be a bug introduced since the last cleanup of NetStation.m

This only happens if you don't specify all arguments to NetStation(). The logic for skipping key/value pairs got truncated.

Also, if you don't specify a time to NetStation() the actual time the event gets put into the netstation recording is not deterministic. If you don't care about the event timestamp that's ok (some use cases are just information purposes not event markers). But I STRONGLY suggest including an explicit timestamp. That's the only way to know.

Try the attached version of NetStation.m and see if that helps.

Justin




On Thu, Sep 8, 2016 at 1:11 PM, meike.scheller@... [PSYCHTOOLBOX] <PSYCHTOOLBOX@yahoogroups.com> wrote:

Hi all,

We've had a couple of problems with getting Matlab and EGI NetStation to communicate for quite some time now but were able to solve most of them.
We are now trying to send event codes from Matlab 2016a to NetStation 5.2.0.1, using the Psychtoolbox NetStation commands.

The code we are using is as follows:

[status, error] = NetStation('Connect','10.10. 10.42','55513’); % 10.10.10.42 = IP address of Mac, where NetStation is installed
NetStation('StartRecording’)
NetStation('Event',’555’)

When we run these commands, status = 0. We receive an error when Matlab attempts to execute ‘NetStation(‘Event’,’555’). The error is:
‘Undefined function or variable ‘status’. Error in NetStation (line 280) error=nserr(status);’

We would be very grateful for any advice as to how to address this error. Please could you advise us as to what could be going wrong?


Thank you & best wishes!


Is this file meant as a general bugfix for the current NetStation.m?

thanks,
-mario
I think it is a general bugfix. But I was hoping to get some feedback as to whether it worked, before initiating a pull request.

Justin

On Mon, Sep 19, 2016 at 5:12 PM, mario.kleiner@... [PSYCHTOOLBOX] <PSYCHTOOLBOX@yahoogroups.com> wrote:

Is this file meant as a general bugfix for the current NetStation.m?

thanks,
-mario


Dear Justin (and Mario),

I am happy to test the script if you tell me of what the critical things are that need to be tested and reported back to you (and it might take a few weeks until I get around to actually do so).

Thank you and kind regards,
Urte

Am 20 Sep 2016 um 01:52 schrieb Justin Ales jma23@... [PSYCHTOOLBOX] <PSYCHTOOLBOX@yahoogroups.com>:


I think it is a general bugfix.  But I was hoping to get some feedback as to whether it worked, before initiating a pull request.

Justin

On Mon, Sep 19, 2016 at 5:12 PM, mario.kleiner@... [PSYCHTOOLBOX] <PSYCHTOOLBOX@yahoogroups.com> wrote:
 

Is this file meant as a general bugfix for the current NetStation.m?

thanks,
-mario




--------------------------------
Urte Roeber, PD Dr. rer. nat. habil. Dipl.-Psych.
Senior Lecturer
School of Psychology and Exercise Science
Murdoch University
90 South Street
Murdoch WA 6150, Australia

E-mail: u.roeber@...
Phone: +61 8 9360 2988
Location: Social Sciences (440) 2.026


The content of this e-mail is intended for the addressee only and may not be forwarded to a third party without my written permission.
--------------------------------







Dear All,

Does anyone know what NetStation(‘FlushReadbuffer’) do? Does it delete all the queueing NetStation(‘Event’) messages? Does it send the messages through to the EEG file? When should I use the NetStation(‘FlushReadbuffer’) - e.g., at the end of the trial?

Thank you,
Natasa

From what I can see, It clears the buffer of received data from the NetStation system. Probably doesn’t hurt to call it at the start or end of a trial to get rid of potential junk in the buffer, or before performing one of the time synchronization functions, although on a well working system one would not expect such junk being present in the first place.
-mario

1 Like