Difference between revisions of "MatNIC Matlab Toolkit"

From Neuroelectric's Wiki
Jump to: navigation, search
 
(12 intermediate revisions by the same user not shown)
Line 10: Line 10:
 
The MatNIC zip file contains the following:
 
The MatNIC zip file contains the following:
  
*Free MatNIC to control remotely the NIC software:
+
*MatNIC: Free MatNIC to control remotely the NIC software:
 
 
 
  - The MatNIC user manual (an explanation on how to use the Matlab functions to remotely control NIC and examples)
 
  - The MatNIC user manual (an explanation on how to use the Matlab functions to remotely control NIC and examples)
 
  - MatNIC, a folder with all the Matlab functions to remotely control NIC
 
  - MatNIC, a folder with all the Matlab functions to remotely control NIC
 
For more information, [https://www.neuroelectrics.com/support/ '''contact us''']  
 
For more information, [https://www.neuroelectrics.com/support/ '''contact us''']  
  
 +
https://www.youtube.com/watch?v=tylnmeet9EQ
  
*Special MatNIC to perform online stimulation changes:
+
*MatNIC Closed-loop: Special MatNIC to perform online stimulation changes [NE006SW]:
 
 
 
  - The MatNIC user manual (an explanation on how to use the Matlab functions to remotely control NIC and examples)
 
  - The MatNIC user manual (an explanation on how to use the Matlab functions to remotely control NIC and examples)
  - MatNIC, a folder with all the Matlab functions to remotely control NIC
+
  - MatNIC, a folder with all the Matlab functions to remotely control NIC and additional functions to perform online stimulation changes
  
 
For more information, [https://www.neuroelectrics.com/get-a-quote/?add=84      '''contact us for a quotation''']
 
For more information, [https://www.neuroelectrics.com/get-a-quote/?add=84      '''contact us for a quotation''']
 
 
  
 
With MatNIC you can command the following actions:
 
With MatNIC you can command the following actions:
Line 40: Line 37:
 
  | Online tDCS Amplitude change | StarStim          |
 
  | Online tDCS Amplitude change | StarStim          |
 
  | Online tRNS Amplitude change | StarStim          |
 
  | Online tRNS Amplitude change | StarStim          |
| Load Protocol                | StarStim          |
 
 
  | Request status              | Enobio & StarStim |
 
  | Request status              | Enobio & StarStim |
 
  \--------------------------------------------------/
 
  \--------------------------------------------------/
Line 62: Line 58:
 
  | Stimulation is OFF                | StarStim          |
 
  | Stimulation is OFF                | StarStim          |
 
  \--------------------------------------------------------/
 
  \--------------------------------------------------------/
 
To run the example please make the following call:
 
>> ret = RemoteStimulationClient (templateName, '127.0.0.1', 1235)
 
where templaName is set with a name of an already defined stimulation template NIC, then the host where NIC is running (in the example above we use the localhost IP, so NIC is running in the same computer) and finally the port 1235 which is where the NIC server runs.
 
Here is the header of the example client code:
 
function [ret] = MatNICTutorial(templateName, host, port)
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
% MatNICTutorial
 
%
 
% This function implements a client to connect to the NIC Remote
 
% Stimulation Server. The server is running on the machine where the NIC
 
% application runs on the port 1235.
 
%
 
% The NIC Remote Server waits for the client to send the name of the
 
% template that the client wants to use. If the NIC user accepts the
 
% remote control session, the template is loaded and the client is
 
% informed when the system is ready to start the stimulation.
 
%
 
% The client then might send the code to start the stimulation or the one
 
% to abort it. The abort command might be sent in any moment of the
 
% stimulation session. If the stimulation session is aborted locally from
 
% the NIC GUI the connection is automatically closed so the client needs
 
% to connect, send the template and wait again for the permission. When
 
% the stimulation script execution is finished the system prepares itself
 
% to start again a new stimulation so the code informing about that is
 
% received.
 
%
 
% The client might also send commands to start and stop receiving the EEG
 
% streaming. The data is received through a separate server on the port
 
% 1234. The 8/20/32 channel samples are sent in 4 bytes in two's complement.
 
% The MSB byte is sent first.
 
%
 
% The following are the functions to connect, send the commands to the
 
% - MatNICConnect
 
% - MatNICConnectQueryStatus
 
% - MatNICConnectLoadTemplate
 
% - MatNICConnectOnlineFreqChange
 
% - MatNICConnectStartStimulation
 
% - MatNICConnectAbortStimulation
 
% - MatNICConnectStartEEG
 
% - MatNICConnectStopEEG
 
% - MatNICConnectOnlineAtdcsChange
 
% - MatNICConnectOnlineAtacsChange
 
% - MatNICConnectOnlineFtacsChange
 
% - MatNICConnectOnlinePtacsChange
 
% - MatNICConnectOnlineAtrnsChange
 
% - MatNICConnectEnableTRNSFilter
 
%
 
%
 
% Input:
 
% templateName: Name of the template to be loaded on NIC.
 
% host: Name or IP of the host where NIC is running.
 
%
 
% Output:
 
% ret: Zero or positive number if the function completes successfully. A
 
% negative number otherwise:
 
% -1: The connection to the host and port number did not succeed.
 
% -2: Error writing template name.
 
% -3: Error reading from server.
 
% -4: Template not loaded.
 
% -5: Error writing command to the server.
 
%
 
% Author: Javier Acedo (javier.acedo@starlab.es) - Sergi Torrellas (sergi.torrellas@neuroelectrics.com)
 
% Company: Neuroelectrics
 
% Created: 16 Jan 2013
 
% Known issues: None
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 

Latest revision as of 10:58, 3 October 2018

Controlling NIC with Matlab: the MatNIC toolkit

MatNIC Remote stimulation client is a Matlab toolkit for agile, programmatinc control of NE devices for advanced researchers. MatNIC functions give you full control of all Neuroelectrics devices. With MatNIC you can, for example, modify in real-time any stimulation parameter, or receive and process EEG data.

For more information, visit the Neuroeletrics website in order to see video tutorials. And if you are interested, please contact us for pricing and more information.

The MatNIC zip file contains the following:

  • MatNIC: Free MatNIC to control remotely the NIC software:
- The MatNIC user manual (an explanation on how to use the Matlab functions to remotely control NIC and examples)
- MatNIC, a folder with all the Matlab functions to remotely control NIC

For more information, contact us

https://www.youtube.com/watch?v=tylnmeet9EQ

  • MatNIC Closed-loop: Special MatNIC to perform online stimulation changes [NE006SW]:
- The MatNIC user manual (an explanation on how to use the Matlab functions to remotely control NIC and examples)
- MatNIC, a folder with all the Matlab functions to remotely control NIC and additional functions to perform online stimulation changes

For more information, contact us for a quotation

With MatNIC you can command the following actions:

/--------------------------------------------------\
| Action                       | Device            |
|--------------------------------------------------|
| Load Protocol                | Enobio & StarStim |
| Start recording EEG          | Enobio & StarStim |
| Stop recording EEG           | Enobio & StarStim |
| Start Stimulation protocol   | StarStim          |
| Pause Stimulation protocol   | Starstim          | 
| Abort Stimulation protocol   | StarStim          |
| Online tACS Frequency Change | StarStim          |
| Online tACS Amplitude change | StarStim          |
| Online tDCS Amplitude change | StarStim          |
| Online tRNS Amplitude change | StarStim          |
| Request status               | Enobio & StarStim |
\--------------------------------------------------/

The previous actions are examples of the toolkit but we provide more actions to control the device and the NIC software.

NIC responds to those commands with a set of status commands to indicate whether the commands are successfully processed, the stimulation is ready to be started and so on. The following table shows all the possible status value that NIC might send.

/--------------------------------------------------------\
| Status                             | Device            |
|--------------------------------------------------------|
| Remote control allowed             | Enobio & StarStim |
| Remote control rejected            | Enobio & StarStim |
| Device is idle                     | Enobio & StarStim |
| EEG streaming is ON                | Enobio & StarStim |
| EEG streaming is OFF               | Enobio & StarStim | 
| Protocol not loaded                | StarStim          |
| Protocol loaded                    | StarStim          |
| Stimulation is ready to be started | StarStim          |
| Stimulation is ON                  | StarStim          |
| Stimulation is OFF                 | StarStim          |
\--------------------------------------------------------/