segmentation of a signal
Show older comments
i have a nx3 matrix of a signal and i want to make small segments of 0.3 ms of this signal. using the following code i can make those segments but i am unable to store all the segments like frame1,frame2...last frame. i dont understand what am i missing in this code. and lastly i get the error"Warning: Integer operands are required for colon operator when used as index" when i use this code. the matrix name is prblm and it is 81920x3
fs=2048;
frame_duration=0.3;
frame_samples_length=(frame_duration*fs);
n= length(prblm);
number_of_frames=floor(n/frame_samples_length);
for k = 1:number_of_frames
frame = prblm((k-1)*frame_samples_length+1:frame_samples_length*k,:);
end
1 Comment
Priyanka Shanmuga Raja
on 9 Jun 2020
frame = prblm((k-1)*frame_samples_length+1:frame_samples_length*k,:);
I guess, here you are trying to index from 1 to a decimal. May be try using floor()
Accepted Answer
More Answers (2)
KSSV
on 9 Jun 2020
fs=2048;
frame_duration=0.3;
frame_samples_length=(frame_duration*fs);
n= length(prblm);
number_of_frames=floor(n/frame_samples_length);
frame = zeros(number_of_frames,3) ;
for k = 1:number_of_frames
frame(k,:) = prblm((k-1)*frame_samples_length+1:frame_samples_length*k,:);
end
Rida Alfonso
on 9 Jun 2020
0 votes
Categories
Find more on Matrix Indexing 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!