segmentation of a signal
Afficher commentaires plus anciens
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 commentaire
Priyanka Shanmuga Raja
le 9 Juin 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()
Réponse acceptée
Plus de réponses (2)
KSSV
le 9 Juin 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
le 9 Juin 2020
0 votes
Catégories
En savoir plus sur Matrix Indexing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!