NetCom Client is an application programming interface (API) to facilitate distributed processing, remote monitoring, and other custom programmed interactions with Cheetah or Pegasus software. While the NetCom API includes interfaces for your custom programmed C++/MFC, Microsoft® .NET, and IronPython applications, you can also interact with your Neuralynx acquisition system using MATLAB® over NetCom's MATLAB interface.
How Recorded Data is Retrieved
For the most part, the MATLAB interface to NetCom Client is very similar to the other NetCom Client libraries. All of the connection, control and query functions are identical. The major difference comes when retrieving data from the acquisition software. Both the C++ and .NET versions of NetCom use “push style” data streaming: when new data is available, NetCom calls a function in your application where you receive that new data, essentially pushing new data into your application. Since MATLAB isn't designed to receive streaming data from multiple sources, we created an interface for MATLAB that uses "pull style" data streaming.
The NetCom interface will buffer all of the incoming data and hold it until your MATLAB script asks to receive new data, thereby pulling it into your script. However, since these buffers are of finite size, you need to periodically pull data out, or your older data will be overwritten with new data. Because of this, all of the NlxGetNew*Data functions (e.g. NlxGetNewCSCData) also return the number of dropped records since the last call to the function. This will let you know how much data you didn't receive.
Another major difference introduced in the MATLAB interface to NetCom Client is how the recorded data is retrieved. Normally, NetCom Client returns a single array of recorded objects. Each record has fields containing the data from that record. In order to make the data retrieved from NetCom Client easier to work with in MATLAB, the interface returns each of those fields into separate MATLAB vectors.
For instance, in C++ you would access the timestamp for the 25th record returned using the following code:
returnedRecords[24].qwTimeStamp
In MATLAB, you would do the following:
returnedTimestamps(25)
More information on how the data fields are returned for each data type can be found with the help of the corresponding NlxGetNew*Data function.
While we always suggest running NetCom applications on a PC other than the one running the acquisition software, this is even more important when MATLAB is used. Since MATLAB is a very resource intensive application, it can cause your computer to slow down if both it and the data acquisition software are running at the same time.
NOTE: If you do need to run both applications on the same PC, please test your system to see if it can handle both applications before recording critical data.
Resources:
The example script MATLABNetComClientExamples.m, located in the NetComExamples/MATLAB directory of the package, will give you a good overview of what commands are utilized in a MATLAB script that interfaces with NetCom. There is also a step-by-step tutorial showing how to create a basic online placefield display using MATLAB.
Neuralynx has compiled several MATLAB / NetCom utilities that may suit your needs or provide a good starting point. Click the link above for descriptions and downloads.
MATLAB is a registered trademark of The MathWorks Inc.
Comments
0 comments
Please sign in to leave a comment.