I have 2 minutes of filtered data that needs to be segmented into 20msec intervals, how would I go about doing that? It was collected at 2048 Hz and there is a total of 245762 data points.
Unless you want to overlap them (that is likely not desirable here), just use:
Fs = 2048; % Sampling Frequency (samples/sec)
segment = 0.02; % Segments (20 ms)
Samples = round(Fs * segment); % Sample Length
y = buffer(x,Samples);
or:
[y,z] = buffer(x,Samples);
depending on what you want to do, and want as a result, so ‘n’ is ‘Samples’ in my code.
Of interest, the documentation requires that ‘n’ is ‘positive real scalar’, so the functions creating it as an integer may not be required. I included those because I always specify ‘n’ as an integer.
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.