Tutorial _ Using Matlab with OpenViBE _ OpenViBE.pdf



Comments



Description

12/30/2014Tutorial : Using Matlab with OpenViBE | OpenViBE Downloads Features Documentation Forum FAQ Contact Search... Tutorial : Using Matlab with OpenViBE Posted on June 11, 2012 by lbonnet NB: last update for OpenViBE 0.17.0 Note from the author : the Matlab plugins for OpenViBE have been developed for the researchers more experienced with Matlab scripting than C++ programming. These plugins now need to be extensively tested to be considered as stable, especially by experienced Matlab users. Please send us your feedback and suggestion of improvement: bug reports, usability feedback, documentation requests, etc. BrowseBurst Related Searches Note: V0.16.x has a bug that Matlab working directory path can not contain spaces, preventing running Matlab tutorial scenarios from their default install location on Windows in “Program Files (x86)”. To use the scenarios, please move them to a folder with no spaces in the path. (This issue has been fixed in the git version.) Note: On V0.17.0 and Linux, the presence of matlab plugin .so can cause crashes in seemingly unrelated Simple ? Interface Design 3D Virtual World DSP box as the two may use different versions of boost which are then wrongly exposed to the other party due to the dlopen() flag RTLD_GLOBAL. Unfortunately this flag is needed or we get other issues with third-party libraries, for example that the imports done inside Python plugin scripts no longer work. The compromise solution is that Matlab plugin compilation is currently by default DISABLED in the main CMakeLists.txt. You may enable the Matlab Brain Control Cognitive plugin compilation and possibly set the flag to RTLD_LOCAL to avoid issues in ovCKernelLoader.cpp, but be aware of the consequences. Neuroscience Neurofeedback Training Biofeedback Therapy EEG Neurofeedback Biofeedback Therapist Introduction OpenViBE is currently compatible with MATLAB through a box: Matlab Scripting: a general-purpose box with unlimited inputs, outputs and settings. User writes the Matlab functions that will be called by the box. This box is developed and supported by the Inria team. It relies on the Matlab Engine, and requires a valid installation of Matlab to be compiled and to run. To be precise, the Matlab documentation states : Brain Function Virtual Reality World The MATLAB engine library contains routines that allow you to call MATLAB software from your own programs, thereby employing MATLAB as a computation engine. You must use an installed version of MATLAB; you cannot run the MATLAB engine on a machine that only has the MATLAB Compiler Runtime (MCR). The Matlab Scripting box is included in the official release packages, and thus can be used directly in any scenario, as long as you have a valid Matlab installation on your computer. Requirements The Matlab box has been tested on Windows 7 32 bits + MATLAB R2011a 32 bits. Unfortunately Matlab R2011a is not compatible with Ubuntu 11.04 and superior versions. The official ubuntu support page says : “MATLAB R2011a was released on April 8, 2011. Please note that this is prior to the release of Ubuntu 11.04. Consequently Ubuntu 11.04 is not a supported operating system for MATLAB R2011a. MATLAB R2011a users are strongly encouraged to install R2011a on Ubuntu 10.04 LTS or Ubuntu 10.10 for best results.“. http://openvibe.inria.fr/tutorial-using-matlab-with-openvibe/ 1/14 Matlab working directory : the directory where are located all your function files. some special characters are not recognized) Initialize function : the name of the Matlab function called by the box when pressing ‘play’ in the scenario. An empty dynamic library will be produced. Default value is 64Hz. eng. Path to Matlab executables (Windows) / Matlab launch command (Linux): tells OpenViBE how to execute the Matlab engine. libmx. http://openvibe.lib under ${Matlab_ROOT}/extern/lib/win32/microsoft/ On Linux : mex. the latest Matlab Release (R2012a) is currently compatible with Ubuntu 10./bin/openvibe-plugins-matlab. Process function : the name of the Matlab function called by the box on every box clock tick. The boxes are not compatible with MATLAB 64 bits on Windows.lib. You can also add new settings in the box. Here is the different settings and how to set it correctly : Box clock frequency (in Hertz) : defines the frequency on which the box will be called by OpenViBE. This path must be Matlab compliant (i..e.04 LTS.fr/tutorial-using-matlab-with-openvibe/ 2/14 .12/30/2014 Tutorial : Using Matlab with OpenViBE | OpenViBE For your information.10. Set it the directory where is matlab.inria. from 1 to 128 Hz. you can lower it if you experience bad performance when executing the box.exe on windows or type the command you use to launch Matlab on Linux. 11. CMake looks for the following libraries when compiling OpenViBE: On Windows : libmex. We will update this section with your feedback ! Compiling the ‘plugins/processing/matlab’ project A valid installation of MATLAB includes all the libraries and exe required to compile and use the boxes. they will be available in the Matlab structure as well. under ${Matlab_ROOT}/bin/glnx86 or ${Matlab_ROOT}/bin/glnxa64 When building the software. To be precise. which will result in the following message in the console when executing the OpenViBE Designer : [WARNING] No 'plugin object descriptor' found from [. Uninitialize function : the name of the Matlab function called by the box when pressing ‘stop’ in the scenario. Each box has its own matlab workspace defined in the box setting. You can add as many input and output as you need. libeng. You can use more than one Matlab Scripting box in the same scenario. Please contact us to inform us of any compatibility issue. as showed in the following build log example: A successful build log on Windows (click here to show content) If the build process does not find a valid MATLAB installation. mx. MATLAB 64 bits on Windows) the build process will find MATLAB but not the libs resulting in the following build log : Build fails on Windows with MATLAB 64 bits (click here to show content) The Matlab Scripting box The Matlab Scripting box is available in the Designer in the category Scripting.04. as stated in the Matlab support page.lib. 11. the boxes won’t be built with the project. All the stream types are compatible.e. the process should find all these libraries.dll] even if it looked like a plugin module When building OpenViBE with an invalid MATLAB installation (i. The box clock and clock frequency are very useful when your script needs to generate an output. The box structure is defined as follow: STRUCT box: > box. This toolbox is installed with openvibe in share/openvibe/plugins/matlab. > box. in DOUBLE output_count : the number of output of the box. // 33024 Thus you can directly compare a stimulation identifier received on an input to these global variables.type : UINT64 openvibe code of the setting type. the same variable is used and thus is updated. output_count) : out STRUCT box : a structure representing the box in Matlab: in DOUBLE input_count : the number of input of the box. Matlab structures and functions description One instance of the Matlab Scripting box creates its own box in Matlab. > box. Setting up the environment The box automatically sets up the Matlab environment to work properly. > box. but lacks an input to synchronize with.inria. The OpenViBE toolbox for the Matlab Scripting box The Matlab Scripting box relies on a set of Matlab functions to work. The setting structures are filled according to the openvibe box settings defined in the scenario. For the functions that outputs a new box instance.inputs : a cell array of input structure(s). For your information. and those who are meant to be called by the user in his script. to create the structures accordingly.fr/tutorial-using-matlab-with-openvibe/ 3/14 . For example a global variable could be modified by all the boxes of the same workspace. > setting. to create the structures accordingly. http://openvibe.clock_frequency : DOUBLE the box clock frequency.settings : an array of setting structure(s).12/30/2014 Tutorial : Using Matlab with OpenViBE | OpenViBE If you are using the same workspace for several boxes. For example: global OVTK_StimulationId_Label_00.clock : DOUBLE the current openvibe time. Then it calls a function that will create several global variables for all the OpenViBE stimulation codes: OV_defines() The name of the variables and their values are strictly the same as in OpenViBE. they will share this workspace. In this section we describe these functions and the structures manipulated by Matlab and OpenViBE. Default settings are not stored in the structure. STRUCT setting : > setting.name : STRING (name of the setting in the openvibe box). here is the procedure: The box first creates a representation of the openvibe box in matlab: box = OV_createBoxInstance(input_count. > box. OVTK_StimulationId_Label_00 = uint64(hex2dec('00008100')). updated at every clock tick. It contains 2 types of functions: those called by the box itself internally. > box.user_data : empty user-space structure.outputs : a cell array of output structure(s). This box is passed as an argument of every functions. The input and output structures are defined by particular headers.type : STRING = 'Spectrum Stream' > header. for a signal: channel names.inria. along with the corresponding functions to set it in a convenient way (i.buffer : CELL ARRAY of chunk structure(s). nb_samples_per_buffer. STRUCT input/output : > io. Once the header is set.12/30/2014 Tutorial : Using Matlab with OpenViBE | OpenViBE > setting. dim_labels) STRUCT header : SIGNAL > header. The different header structures are listed below. dim_sizes.sampling_rate : DOUBLE sampling frequency Setter Function (optional): [box_out] = OV_setSignalOutputHeader(box_in.nb_features : DOUBLE number of feature in the vector > header. the Matlab Scripting box is able to get this information from the matlab structure and construct the corresponding OpenViBE header. NB: A corresponding Getter function also exists for each header type.dimension_sizes : 1xN DOUBLE ARRAY of dimension sizes (one size per dimension) > header.fr/tutorial-using-matlab-with-openvibe/ 4/14 . output_index. sampling rate. output_index.channel_names : CELL ARRAY of STRING http://openvibe. STRUCT header : STREAMED MATRIX > header.e. Manually setting the header structures of your output is of course also possible (e.type : STRING = 'Feature Vector Stream' > header.labels : CELL ARRAY of STRING Setter Function (optional): [box_out] = OV_setFeatureVectorOutputHeader(box_in. and modify the box representation accordingly.nb_dimensions : DOUBLE number of dimensions of the matrix (N) > header. Its type can be DOUBLE (for the openvibe types integer and float). UINT64 (stimulation code) or STRING (anything else).nb_samples_per_buffer : DOUBLE number of samples per buffer block > header.g. nb_channel. nb_features. When the Matlab Scripting box receives the headers on its inputs it forwards the information to Matlab. The IO structures also contains a buffer for the incoming chunk of data.channel_names : CELL ARRAY of STRING > header.header : STRUCT containing the stream description (e.g. and are meant to be filled at run time. nb_dim. output_index. These functions are called by the Matlab Scripting box to get all the information in one call to the Matlab engine.header = output.nb_channels : DOUBLE number of channels > header.type : STRING = 'Streamed Matrix Stream' > header.value : the value of the setting. if your output stream has the same structure as an input. > io. LOGICAL (boolean). channel_names. labels) STRUCT header : SPECTRUM > header. input. you won’t miss a field).dimension_labels : 1xN CELL ARRAY of STRING Setter Function (optional): [box_out] = OV_setStreamedMatrixOutputHeader(box_in. sampling_rate) STRUCT header : FEATURE VECTOR > header. The output headers structure must be set by the user in the Matlab script.type : STRING = 'Signal Stream' > header.nb_channels : DOUBLE number of channels > header.header is the simplest way to set it). etc). % To pop the oldest chunk in a buffer (i. precision 0. > chunk. nb_channels.end_time : DOUBLE > chunk. nb_channels. STRUCT chunk : MATRIX CHUNK > chunk.bands : [nb_bands x 2 DOUBLE] the pairs of frequencies (band start and stop) Setter Function (optional): [box_out] = OV_setSpectrumOutputHeader(box_in.end_time : DOUBLE > chunk. bands) STRUCT header : CHANNEL LOCALISATION > header.type : STRING = 'Stimulation Stream' Setter Function (optional): [box_out] = OV_setStimulationsOutputHeader(box_in) As you can see all the setter functions take a box structure as input. > chunk. The chunk structure stored in the IO buffers can be either a matrix (for Stramed Matrix stream and its child streams) or a stimulation set..matrix_data : DOUBLE ARRAY the matrix of data.. The buffers may contains any number of chunks. nb_bands. STRUCT chunk : SIMULATION CHUNK > chunk.start_time : DOUBLE translation of the openvibe timestamp in seconds. continue using the 'box' variable .fr/tutorial-using-matlab-with-openvibe/ 5/14 .dynamic : LOGICAL tells if coordinates are dynamic Setter Function (optional): [box_out] = OV_setChannelLocalisationOutputHeader(box_in. and output the modified box structure. 1 stimulation per column.band_names : CELL ARRAY of STRING the name of the bands (e.nb_bands : DOUBLE number of frequency bands in the spectrum > header. band_names. channel_names. the first chunk to process) http://openvibe.nb_channels : DOUBLE number of channels > header. output_index.. in STRUCT box_in : the box structure.) % . dynamic) STRUCT header : STIMULATIONS > header. '10-15Hz') > header. For example.inria. date and duration.0001 sec. The buffers can be manipulated through convenient matlab functions: % To get the current count of pending chunk in buffer: nb_pending = OV_getNbPendingInputChunk(box_in. The structure of the matrix is the same as in OpenViBE. a signal matrix has N(channels) lines and N(samples) columns. precision 0. channel_names. Each stimulation is defined by its code.start_time : DOUBLE translation of the openvibe timestamp in seconds.matrix_data : DOUBLE ARRAY the stimulation set containing N stimulation(s).12/30/2014 Tutorial : Using Matlab with OpenViBE | OpenViBE > header. ie..channel_names : CELL ARRAY of STRING > header. A typical call is thus: box = OV_setXXXXXOutputHeader(box..e.0001 sec. N stimulations are stored in a 3xN matrix. output_index.. input_index) out DOUBLE nb_pending : the number of pending chunk in the buffer. in DOUBLE input_index : index of the input.type : STRING = 'Channel Localisation Stream' > header. .g. It outputs a signal which has the same structure (channel count. start_time. in STRUCT box_in : the box structure. If there is no chunk in the buffer the function returns: > start_time = -1 > end_time = -1 > matrix_data = [] When you need to output a new buffer. type and structure depends on the stream type.matrix_data). If the same stimulation is received once again.inria. in DOUBLE start_time : the chunk start time in seconds. end_time.12/30/2014 Tutorial : Using Matlab with OpenViBE | OpenViBE % Note that the chunk is removed from the buffer after this call. out DOUBLE box_out : the box after modification. matrix_data] = OV_popInputBuffer(box_in.end_time. It must be an absolute path. This scenario is very simple : it filters a sinus signal and sets all the samples to 0 when receiving a specific stimulation. First step is to configure the Matlab Scripting box. in DOUBLE end_time : the chunk end time in seconds. type and structure depends on the stream type Tutorial 1 : signal filter Open the scenario share/openvibe/scenarios/box-tutorials/matlab/tuto1-signal-filter. This defines which stimulation is used to switch the behavior of the box. in DOUBLE output_index : index of the input. out DOUBLE end_time : the chunk end time in seconds.) as the input. out DOUBLE start_time : the chunk start time in seconds. as you can notice we added a new setting named “zero trigger” of type Stimulation.xml. in DOUBLE input_index : the input index in the box. You need to set your local Matlab directory and the working directory to match your local installation of Matlab and OpenViBE. in ARRAY matrix_data : the data. The working directory is [openvibe]/share/openvibe/scenarios/box-tutorials/matlab/. input_index) out STRUCT box_out : the Matlab box after modification.output_index. The three matlab functions are in this directory.fr/tutorial-using-matlab-with-openvibe/ 6/14 . Finally. you can do so by calling the following function: % To add a new chunk in an output buffer: [box_out] = OV_addOutputBuffer(box_in. out ARRAY matrix_data : the data. etc. [box_out. the output signal goes back to normal. Configuring the Matlab Scripting Box http://openvibe.start_time. in STRUCT box_in : the Matlab box from which we pop a new chunk. The Matlab Scripting box takes 2 inputs : the signal and the stimulation stream. tuto1_signal_filter_Initialize. As we only modify the samples values of the input signal. you can see the corresponding output : http://openvibe. This will be done with every process but it is only needed once (prior to the first buffer ever sent). Uninitialization script Open the Matlab function file tuto1_signal_filter_Uninitialize. Process script Open the Matlab function file tuto1_signal_filter_Process.m (click here to show content) We don’t need to do anything when stopping the scenario. we use the current box instance as output. Please note that we must output the modified box to be able to use it afterwards.fr/tutorial-using-matlab-with-openvibe/ 7/14 . we just display a message.m. It works in two steps. The signal is set to 0 when the stimulation OVTK_StimulationId_Label_01 (33024) is received.12/30/2014 Tutorial : Using Matlab with OpenViBE | OpenViBE Initialization script Open the Matlab function file tuto1_signal_filter_Initialize. to continue the processing on an updated box structure. tuto1_signal_filter_Uninitialize. Execution The result can be found below. First we check the stimulation input for new triggers. This function will be called once.m (click here to show content) As we set the box clock frequency to 64 Hz. In this case. and switch the box field accordingly.m. tuto1_signal_filter_Process.inria. Note that every time we pop a new input chunk. when pressing “play” in the scenario. the “pop” functions remove the last input chunk from the buffer. In the console. this function will be called 64 time per second.m.m (click here to show content) This function add a field in the user_data structure in the box : a boolean indicating the current state of the trigger. we set the output header as a copy of the input header. At the end. tuto2_FFT_filter_Process.m. If your input stream has a high frequency. In our scenario. This function will be called once. and he’s just the input header with one constraint : one channel only. using Time Based Epoching. http://openvibe. when pressing “play” in the scenario. You need to set your local Matlab directory and the working directory to match your local installation of Matlab and OpenViBE. and the frequency range used for plotting the spectrum. we will plot the mean spectrum before stopping the scenario.m.m (click here to show content) The header is set once.m (click here to show content) This function prints the box settings and add fields in the user_data structure in the box : a boolean indicating if we need to set the output header. In this scenario we add some noise in the upcoming signal.fr/tutorial-using-matlab-with-openvibe/ 8/14 . First step is to configure the Matlab Scripting box. We added 4 FLOAT settings : the noise frequency and amplitude. and plot the spectrum amplitude (FFT) in Matlab to check if this noise appears in the signal. The three matlab functions are in this directory.12/30/2014 Tutorial : Using Matlab with OpenViBE | OpenViBE Console output (click here to show content) Tutorial 2 : FFT and Matlab plot Open the scenario share/openvibe/scenarios/box-tutorials/matlab/tuto2-FFT-filter. The FFT is plotted on every input chunk. tuto2_FFT_filter_Initialize. Please note that we must output the modified box to be able to use it afterwards. The working directory is [openvibe]/share/openvibe/scenarios/box-tutorials/matlab/. Initialization script Open the Matlab function file tuto2_FFT_filter_Initialize. thus the output signal has only one channel. Therefore you will have one figure updated every 2 seconds of signal. Please note that we only do this process on the first channel of the signal. It must be an absolute path. we compute a 2 second window before passing it to Matlab.inria. and the variables we need to compute the mean spectrum. that will be added in the signal.xml. Process script Open the Matlab function file tuto2_FFT_filter_Process. you won’t be able to see something. Uninitialization script Open the Matlab function file tuto2_FFT_filter_Uninitialize.12/30/2014 Tutorial : Using Matlab with OpenViBE | OpenViBE The figure plotted has 3 subfigures : the pure noise signal.fr/tutorial-using-matlab-with-openvibe/ 9/14 .m.inria. and the amplitude spectrum.m (click here to show content) The Uninitialize function plots the mean spectrum amplitude matrix and pauses the execution for 10 seconds. tuto2_FFT_filter_Uninitialize. the scenario is stopped and the Matlab engine closed (so it closes any figure automatically). the signal corrupted with this noise. After the pause. Execution Signal display in OpenViBE Plotting the results in Matlab http://openvibe. With 16 samples per buffer.fr/tutorial-using-matlab-with-openvibe/ 10/14 . we thus have a sampling frequency of 32*16 = 512Hz. The Matlab Scripting box is configured to produce a sinusoidal signal and stimulations. 20Hz for second. you can see the corresponding output : Console output (click here to show content) Tutorial 3 : Signal and Stimulation generator Open the scenario share/openvibe/scenarios/box-tutorials/matlab/tuto3-sinus-generator. Initialization script http://openvibe. the box clock frequency is set to 32Hz. the samples per buffer count (integer). the amplitude of signal (float). and the stimulation sent every second. etc.inria. In the current configuration. The signal is simply a different sinusoid for each channel.xml. We added 4 new settings in the box : the channel count (integer). the frequency being a multiple of 10Hz (10Hz for first channel.).12/30/2014 Tutorial : Using Matlab with OpenViBE | OpenViBE Mean spectrum amplitudes In the console. tuto3_sinus_generator_Process.m.m (click here to show content) As you can see the Uninitialize function does nothing. tuto3_sinus_generator_Initialize. tuto3_sinus_generator_Uninitialize. Most of the time it’s an empty set. a stimulation set is made of N columns. One channel per line. we also produce a stimulation set. As you notice. as the matrix is indexed column after column. a sample and a chunk counters. you can see the corresponding output : Console output (click here to show content) Few words about the Matlab Filter box The Matlab project in the OpenViBE software platform contains a previous prototype for scripting with Matlab in OpenViBE : the Matlab Filter Box. This matrix structure allows the box to parse all the stimulations in a set directly. along with stimulations (one every second – see the red lines): Sinus Generator In the console.m. samples_per_buffer columns. http://openvibe. date then duration). we can set the headers in the initialization phase.12/30/2014 Tutorial : Using Matlab with OpenViBE | OpenViBE Open the Matlab function file tuto3_sinus_generator_Initialize.fr/tutorial-using-matlab-with-openvibe/ 11/14 . Execution The box generates some sinusoidal signal automatically. Please note that we use the same variable box_in as output of these functions so we keep working on an updated box structure.inria. For this purpose we use the functions of the openvibe toolbox. Process script Open the Matlab function file tuto3_sinus_generator_Process. Uninitialization script Open the Matlab function file tuto3_sinus_generator_Uninitialize.m. but it’s still important as the other box after our generator may need to know if there is no stimulation is the last time range. As we produce ourselves the signal and stimulation streams. Along with each chunk of signal.m (click here to show content) This function prints the box settings and add fields in the user_data structure in the box : the end time of the last data chunk sent. one stimulation per column (stim identifier.m (click here to show content) We produce a N-by-M signal matrix. The Process function will be called every time a chunk is available on both inputs. The OpenViBE Designer would then be still waiting for the Matlab Engine to respond: you can expect the application to freeze for about 30 seconds.inria. The main difference between the 2 boxes is the data structure for the matrices: in the Matlab Filter box. It means that you absolutely need a Streamed Matrix input (or derivated. the working directory in which you created the initialize and process functions. and fixed outputs (same). the call to Matlab engine fails and the following message would be printed in the console: [ ERROR ] At time 0.000 sec <Box algorithm::Matlab Scripting> Could not open Matlab engine [WARNING] Box algorithm <Matlab Scripting> has been deactivated because initialization phase returned bad status The box being deactivated. we review the most common errors and mistakes and what they can cause. Failed to Load Matlab Engine at first try With the Windows Installer version. is not displayed in the Designer and is not recommended for use. you can use a dummy input using Clock stimulator or Sinus Oscillator boxes on the useless input. signal) and a stimulation input. e. the Matlab Engine (if everything is correctly set) should successfully run. Did you correctly set the output header in the matlab structure ? http://openvibe. Matlab License The Matlab Engine can be launched in background only if it can access a valid Matlab License. what do I do ? In order to get MATLAB filter to work properly on Linux.so: cannot open shared object file: No such file or directory’? Before launching Designer. Troubleshooting In this section. the signal matrix is oriented as N(channels)columns for N(samples)lines. we identified an incorrect behavior of the box : when pressing play for the first try. Please contact us on the regular channels if you find any unexpected behavior or bugs so we can either correct the Matlab boxes or add new items in this section. the scenario won’t find Matlab and the box will fail to execute correctly. If you don’t need one of them. it does not process any data but the scenario would keep running without it. it will output an error window. This is not always the case.12/30/2014 Tutorial : Using Matlab with OpenViBE | OpenViBE This box is still flagged as deprecated. Investigations are in progress. MATLAB filter keeps saying ‘Can’t start MATLAB engine’. Output Headers : be sure to set it right ! If you try to send a new buffer on an output and you get this message for example : [ ERROR ] At time 0. If the Matlab License Manager can’t get a valid License. The Matlab Filter box has fixed inputs (1 streamed Matrix and 1 stimulation inputs). On Linux. notably on Ubuntu distributions.g. loading the Matlab plugin says ‘error:libmx. you need cshto be installed.094 sec <Box algorithm::Signal filter> Error calling [OV_getSignalOutputHeader]. This bug does not happen with an OpenViBE built from sources.so files are installed. After this timeout. you must export LD_LIBRARY_PATH to include the path where the Matlab .fr/tutorial-using-matlab-with-openvibe/ 12/14 . The box has to be configured with the path or command to launch Matlab on your computer. When re-playing the scenario by pressing play once again. A simple example is provided with the Matlab Filter box documentation page. On Linux. Meaning that the OpenViBE Player. If an error occurs the Matlab Engine may not be closed correctly... this window should be closed automatically. You can either use an existing header. Quick Access OpenViBE World Development Community Downloads Contact How to contribute Forum Source Repository Publications Bugtracker Contributors License Made With Inria gForge Community Website Features Related Projects Build status Documentation Inria Homepage http://openvibe. [WARNING] <Player::can not reach realtime> 2 second(s) late. Matlab launch a specific window called Matlab Command Window. Solution : set the header before the very first buffer sent.g. as it is done in tutorial 1.. [WARNING] <Player::can not reach realtime> 3 second(s) late. if you omit a field or use a field incorrectly (e. that schedules the process of every boxes. if you set the Matlab scripting box clock frequency to 32Hz. the application has a good chance of crash. This entry was posted in Tutorials and tagged Matlab. When opening the engine.. The Matlab process function may have to process more chunk of data at a time (internal buffers are filled continuously). still in the state you left it ! This can lead to unexpected behavior (e. If a box spends too much time its process loop. For example. Tutorial..12/30/2014 Tutorial : Using Matlab with OpenViBE | OpenViBE It means that you didn’t set the header (here it’s a signal output) correctly. one process call should be less than 1/32 th second long.sampling_rate = 'plop') the Designer can just randomly crash during execution. or the dedicated Matlab functions as in tutorial 3. if you have some global variables you are using in your script. they will still be there). header. Otherwise..g. Be sure to save your OpenViBE scenarios often. The simplest way to check the state of the Matlab Engine is by looking at the matlab window running in background. Bookmark the permalink.. This means that when you will run a scenario with a Matlab Scripting box once again. the process loop accumulates a delay. [WARNING] <Player::can not reach realtime> 4 second(s) late. When closing the Engine.inria.. If you construct a somehow corrupted header or a header that does not match the theoretical stream structure.fr/tutorial-using-matlab-with-openvibe/ 13/14 . it will use the previous engine. Performance issues Depending on the processing you implemented the Matlab scripting boxes may take some time to do the process. but you will save the “interface time”. a message would be printed in the console: [WARNING] <Player::can not reach realtime> 1 second(s) late. is not able to process the data in real-time. between the C++ code and the Matlab engine. close it manually before playing such scenario. The box is not able to construct the OpenViBE output stream. For example.. [WARNING] <Player::can not reach realtime> 5 second(s) late. We are aware of this problem and we will try to improve error handling in the following updates.. Try to lower the clock frequency to extend the period of time between 2 process calls. If such window is still alive when there is no Matlab scenario running in the OpenViBE Designer. This window is a basic Matlab interpreter in which you can type Matlab commands. Manually closing the Matlab engine The Matlab Scripting box opens the Matlab Engine on initialization (play) and closes it when uninitializing (stop). 12/30/2014 Tutorial : Using Matlab with OpenViBE | OpenViBE IRC: #openvibe @ irc.freenode.inria. Hosted by powered by WordPress http://openvibe.fr/tutorial-using-matlab-with-openvibe/ 14/14 .net Inria Rennes (© 2014) T witter: @openvibebci All logos and tradem arks belong to their respective copyright owners.
Copyright © 2024 DOKUMEN.SITE Inc.