Warning: Integer operands are required for colon operator when used as index. How can I rectify this?
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Mary Jeethu A J
il 5 Ago 2021
Commentato: Mary Jeethu A J
il 5 Ago 2021
This is my code and I'm using R2021a.
clear all;
[signal,fs] = audioread('sample.wav');
f_d = 0.025;
f_size = f_d*fs;
n = length(signal);
n_f = floor(n/f_size);
temp = 0;
for i = 1 : n_f
frame(i,:) = signal(temp + 1 : temp + f_size); % Warning is showed here;
temp = temp + f_size;
end
if mod(n_f,2) == 1
frame(n_f+1,:) = zeros(size(frame(1,:)));
n_f=n_f+1;
end
save('framed');
0 Commenti
Risposta accettata
Bjorn Gustavsson
il 5 Ago 2021
Modificato: Bjorn Gustavsson
il 5 Ago 2021
Make sure that your variable f_size is an integer, perhaps something like this solves your problem:
f_size = round(f_d*fs);% ceil or floor should also work if you prefer either
HTH
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Introduction to Installation and Licensing 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!