An undefined Array length for streamed LSL data

조회 수: 17 (최근 30일)
BionicP
BionicP 2020년 11월 9일
댓글: Walter Roberson 2020년 11월 9일
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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by