Matlab Scripting

Summary

Doc_BoxAlgorithm_MatlabScripting.png
  • Plugin name : Matlab Scripting
  • Version : 1.0
  • Author : L. Bonnet
  • Company : INRIA
  • Short description : Executes matlab scripts. To be used correctly, you must have Matlab installed.
  • Documentation template generation date : Oct 18 2012

Description

User must implement the matlab functions: [box_out]=bci_Initialize(box_in) [box_out]=bci_Process(box_in) [box_out]=bci_Uninitialize(box_in) Please refer to the dedicated documentation <openvibe.inria.fr/tutorial-using-matlab-with-openvibe> for more information.

The Matlab Scripting box uses the Matlab Engine to process data using Matlab. This box can be configured with any number of inputs, outputs and settings, of any type. You will need a valid Matlab installation and license at runtime. This box is currently compatible with Matlab 32 and 64 bits on Linux, but only with Matlab 32 bits on Windows.

For a complete tutorial, please check this documentation page.

Settings

1. Box clock frequency in Hz

The box clock frequency can be an integer between 1 and 128Hz. This tells how many time per second the box "Process" function will be called.

  • Type identifier : Integer (0x007deef9, 0x2f3e95c6)
  • Default value : [ 64 ]

2. Path to Matlab Executables

User must set the place where to find the Matlab executables. On windows it should be in the bin/win32 directory. On Linux, fill this setting with the command line you are using to launch Matlab on your computer.

  • Type identifier : String (0x79a9edeb, 0x245d83fc)
  • Default value : [ C:/Program Files/MATLAB/R2011a/bin/win32 ]

3. Matlab working directory

Please enter the Matlab working directory in which this box will work. This should be the absolute adress of the folder where you have put all the function files.

  • Type identifier : String (0x79a9edeb, 0x245d83fc)
  • Default value : [ [path-to-my-matlab-workspace] ]

4. Initialize function

The name of the matlab function called when initializing the box (i.e. when pressing play in the scenario). This function is called only once.

Its signature must be: [box_out] = initialize(box_in), where box_out and box_in are specific structure. Please see the dedicated tutorial for a complete reference.

  • Type identifier : String (0x79a9edeb, 0x245d83fc)
  • Default value : [ matlab_Initialize ]

5. Process function

The name of the matlab function called on every tick of the process loop. This function is called at the box clock frequency.

Its signature must be: [box_out] = process(box_in), where box_out and box_in are specific structure. Please see the dedicated tutorial for a complete reference.

  • Type identifier : String (0x79a9edeb, 0x245d83fc)
  • Default value : [ matlab_Process ]

6. Uninitialize function

The name of the matlab function called when uninitializing the box (i.e. when pressing stop in the scenario). This function is called only once.

Its signature must be: [box_out] = uninitialize(box_in), where box_out and box_in are specific structure. Please see the dedicated tutorial for a complete reference.

  • Type identifier : String (0x79a9edeb, 0x245d83fc)
  • Default value : [ matlab_Uninitialize ]

Examples

The dedicated tutorial provides 3 examples:

  • Signal filtering
  • FFT computation and spectrum plot in Matlab
  • Signal and stimulation generator

Miscellaneous