An undefined Array length for streamed LSL data

16 次查看(过去 30 天)
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