An undefined Array length for streamed LSL data
19 ビュー (過去 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 Center および File Exchange で Descriptive Statistics についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!