Changes

Jump to navigation Jump to search
1,520 bytes added ,  14:09, 23 January 2023
Line 25: Line 25:  
   {{Infobox tsg
 
   {{Infobox tsg
 
     | child              = yes
 
     | child              = yes
     | downloads          = {{bulleted list
+
     | downloads          =  
        | [https://docs.openbci.com/ Documentation]
  −
    }}
   
     | manuals            = {{bulleted list
 
     | manuals            = {{bulleted list
 
         | [https://docs.openbci.com/ Documentation]
 
         | [https://docs.openbci.com/ Documentation]
 +
        | [https://sccn.ucsd.edu/~mgrivich/LSL_Validation.html LSL Validation]
 +
        | [https://labstreaminglayer.readthedocs.io/info/supported_devices.html Supported Devices and Tools]
 
     }}
 
     }}
 
     | header2            = Templates
 
     | header2            = Templates
     | data2              = *[https://surfdrive.surf.nl/files/index.php/s/LN5KRN9cB3mvPp3 Template 2017 (zip)]]
+
     | data2              = {{bulleted list
 +
        | [https://surfdrive.surf.nl/files/index.php/s/qggfMMKsnUIDO0k example scripts (zip)]
 +
    }}
 
   }}
 
   }}
 
}}
 
}}
Line 102: Line 104:  
</syntaxhighlight>
 
</syntaxhighlight>
   −
==References==  
+
=== Matlab ===
<references />
+
Please, read the instructions on the GitHub labstreaminglayer website (https://github.com/labstreaminglayer/liblsl-Matlab) on how to prepare Matlab to work with LSL. You can either use the latest release for your Matlab version, or if that doesn't workout well, build it from the source files. Make sure to add the liblsl-Matlab folder to your path recursively to make it available to your own scripts.
 +
 
 +
A short example for sending lsl streaming data:
 +
<syntaxhighlight lang="matlab" line>
 +
%% instantiate the library
 +
disp('Loading library...');
 +
lib = lsl_loadlib();
 +
 
 +
% make a new stream outlet
 +
disp('Creating a new streaminfo...');
 +
info = lsl_streaminfo(lib,'BioSemi','EEG',8,100,'cf_float32','sdfwerr32432');
 +
 
 +
disp('Opening an outlet...');
 +
outlet = lsl_outlet(info);
 +
 
 +
% send data into the outlet, sample by sample
 +
disp('Now transmitting data...');
 +
while true
 +
    outlet.push_sample(randn(8,1));
 +
    pause(0.01);
 +
end
 +
</syntaxhighlight>
 +
 
 +
A short example for receiving lsl streaming data:
 +
<syntaxhighlight lang="matlab" line>
 +
%% instantiate the library
 +
disp('Loading the library...');
 +
lib = lsl_loadlib();
 +
 
 +
% resolve a stream...
 +
disp('Resolving an EEG stream...');
 +
result = {};
 +
while isempty(result)
 +
    result = lsl_resolve_byprop(lib,'type','EEG'); end
 +
 
 +
% create a new inlet
 +
disp('Opening an inlet...');
 +
inlet = lsl_inlet(result{1});
   −
==External Links== <!-- Optional -->
+
disp('Now receiving data...');
*{{Official website|https://unity3d.com}}
+
while true
*[https://docs.unity3d.com/Manual/index.html Official Documentation]
+
    % get data from the inlet
 +
    [vec,ts] = inlet.pull_sample();
 +
    % and display it
 +
    fprintf('%.2f\t',vec);
 +
    fprintf('%.5f\n',ts);
 +
end</syntaxhighlight>

Navigation menu