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 view (last 30 days)
  2 Comments
Guillaume
Guillaume on 8 Oct 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.
fooozie mtlb
fooozie mtlb on 8 Oct 2015
i got 450082 wave height data. each data have it value. to apply my formula i need to separate data into frame like 256 for each frame. that meant, frame A1 is from 1 until 256, for frame A2 from 257 until 512 and so on. my question is how can i loop data from 1 until 256 to get one value and meanwhile it will loop to another frame A2 and so on.

Sign in to comment.

Accepted Answer

Thorsten
Thorsten on 8 Oct 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

More Answers (2)

Eng. Fredius Magige
Eng. Fredius Magige on 8 Oct 2015
Edited: Eng. Fredius Magige on 8 Oct 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
  1 Comment
fooozie mtlb
fooozie mtlb on 8 Oct 2015
Edited: fooozie mtlb on 8 Oct 2015
% z= height n t= time
for i=1:length(z)-1; % column of xx % total length of column d(i)=sqrt(abs(z(i+1,1)-z(i,1)).^2+abs(t(i+1,1)-t(i,1)).^2); %dist(s1,s2) = sqrt[(x1-x2)^2 + (y1 - y2)^2]; dmax(i)=sqrt((abs(z(i+1,1)-z(1,1)).^2+abs(t(i+1,1)-t(1,1)).^2)); for hx=round(linspace(0,len,fs));
% how to looping im stack here!!!
hxx(i)=hx(1,i+1)-hx(1,i); %ggggggggggggggggggggggggggggggggggggggggggg L=sum(d); %sum of distance between successive point a=mean(d); % average distance between successive point D=max(dmax); % diameter of curve of farthes distance between starting point into any other point n=double(L./a); % to form in double values den=double(D./L); % to form in double values k= (log10(n))./(log10(den)+log10(n)); end end

Sign in to comment.


Guillaume
Guillaume on 8 Oct 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

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!