An undefined Array length for streamed LSL data

18 Ansichten (letzte 30 Tage)
BionicP
BionicP am 9 Nov. 2020
Kommentiert: Walter Roberson am 9 Nov. 2020
Hi,
I am working on a project that streams EMG data from a device to MATLAB via LSL (Which is working streaming 4 channels perfectly). I am now at a cross roads where I need to define an array of a length i am unsure about as of now and save the data for processing.
My aim is to take the most recent 2000 pieces of information and work with those. Allow Matlab a couple seconds of processing and refresh the stream .
My question is how do i store the info in an array like this, i have tried at the bottom but it only stores the first 4 values.
The data comes as 4 channels.
Thanks!
% 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});
disp('Now receiving chunked data...');
while true
% get chunk from the inlet
[chunk,stamps] = inlet.pull_chunk();
for s=1:length(stamps)
% and display it
fprintf('%.2f\t',chunk(:,s));
fprintf('%.5f\n',stamps(s));
v = chunk(:,s);
for i = 1:2000
EMG = [v(i)];
disp(EMG);
end
end
pause(0.05);
end

Antworten (0)

Kategorien

Mehr zu Descriptive Statistics finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by