How do i bin large data sets?

I am trying to bin a large 2000hz data set into averge bins of 100ms for EMG data.
I have tried to reshape the data but Matlab keeps throwing up the problem that there are "not enough input arguments" currently the script reads
%reshape data by order 100
data_binned= mean(reshape(data,100,length,(data)/100,1));

回答 (3 件)

Robert
Robert 2016 年 5 月 2 日

0 投票

It looks like you have an extra comma after length, which would cause the error you are seeing.
Connor
Connor 2016 年 5 月 2 日
編集済み: Connor 2016 年 5 月 2 日

0 投票

Thank you, that sorted out the issue however I am now getting the error message
"error in reshape: size arguments must be real integers"
Same code with the comma removed!
Walter Roberson
Walter Roberson 2016 年 5 月 2 日

0 投票

Fs = 2000;
t = 0.100;
blocksize = round(Fs*t);
numsamp = length(data);
num_blocks = floor(numsamp/blocksize);
blocks = blocksize * ones(1, num_blocks));
sampsused = num_blocks * blocksize;
if sampsused ~= numsamp
blocks(end+1) = numsamp - sampsused;
end
datacell = mat2cell(data(:), blocks, 1);
The above will break the data up into separate cell array entries.
But possibly for your purpose you just need
Fs = 2000;
t = 0.100;
blocksize = round(Fs*t);
data_binned = buffer(data(:), blocksize);

カテゴリ

ヘルプ センター および File ExchangeStatistics and Machine Learning Toolbox についてさらに検索

タグ

質問済み:

2016 年 5 月 2 日

回答済み:

2016 年 5 月 2 日

Community Treasure Hunt

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

Start Hunting!

Translated by