i got 450082 number or data. To process the data i need to make sampling rate to separated that data in a frame. how to process that data in every frame?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
2 Commenti
Guillaume
il 8 Ott 2015
The question body is just an image with no explanation.
the question title is really not clear. What exactly are you asking?
Note that
>>rem(450082, 256)
ans =
34
450082 is not a multiple of 256. Whatever your question is, you need to explain what you're planning to do with the 34 elements left over.
Risposta accettata
Thorsten
il 8 Ott 2015
for i = 1:256:numel(z)
zi = z(i:i+255); % get the i'th chunk of 256 values
% do some sample computations on zi
dzi = diff(zi); % difference between successive values of z
m(i)= mean(zi);
md(i) = mean(dzi); % average difference between successive values of z
end
1 Commento
Guillaume
il 8 Ott 2015
z(i:i+255)
This fill fail for the last frame which is only 34 elements long.
Più risposte (2)
Eng. Fredius Magige
il 8 Ott 2015
Modificato: Eng. Fredius Magige
il 8 Ott 2015
Hi Your subframe, say A, are all uniformity 256 for n=1:450082/256 process whatever your requirement in each subframe as calling function: for nn=n:nnn end end
Guillaume
il 8 Ott 2015
There are many ways to do split your data into frames of size 256. Which one is best probably depends on what you want to do with the frames.
What you still haven't explained is what you're planning to do with the leftover 34 elements.
Starting point:
waveheights = randi([1 100], 1, 450082); %input wave height
processingfun = @(frame) disp(frame); %some processing function
Option 1: split the data into a cell array, use cellfun (or a for loop) for further processing. The 34 leftover are a slight additional hurdle
splits = [ones(1, floor(numel(waveheights)/256))*256, rem(numel(waveheights), 256)];
waveframes = mat2cell(waveheights, 1, splits);
cellfun(processingfun, waveframes);
Option 2: reshape the data into a matrix. The 34 leftover have to be removed
waveheightshort = waveheights(1:end-rem(end, 256); %remove leftovers
waveframes = reshape(waveheightshort, 256, []); %each columne of waveframe is a frame
for frame = 1:size(waveframes, 2)
processingfun(waveframe(:, frame));
end
Option 3: just use loops.
for frame = 1:256:numel(waveheigts)
waveframe = waveheigt(frame:min(frame+255, end));
processingfun(waveframe);
end
0 Commenti
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!