Parse Error at '['
3 次查看(过去 30 天)
显示 更早的评论
function [fdly,tdly] = audio(sig1,sig2)
i = 1;
j = 1;
fdly = zeros(1,266);
tdly = zeros(1,266);
while (i <= 12768000)
a = sig1(i:48000);
b = sig2(i:48000);
[cor,lag] = xcorr(a,b,'coeff');
[~,Il] = max(abs(cor));
fdly(j) = lag(Il);
tdly(j) = fdly(j)/48000;
i = i+48000;
j = j+1;
end
end
*[* sp1,fs1] = audioread('F:\Moodle\Summer18\sync porject\iitb recordings\01_SPK1_05_06_2017-09.wav');
I am getting parse error at the marked bracket, I don't know why!
2 个评论
Guillaume
2018-5-22
Please post (or attach as a m file) the exact code you're using. Without any modification. Also post the full text of the error message.
You've given us conflicting versions of your code. With this particular error, the problem is from what comes before the [.
回答(1 个)
KSSV
2018-5-22
[sp1,fs1] = audioread('F:\Moodle\Summer18\sync porject\iitb recordings\01_SPK1_05_06_2017-09.wav');
There should be no stars, in the first place. And this line should be copied above your function audio not, after the function.
3 个评论
KSSV
2018-5-22
Save this code first, defualt this will be saved on the name delaycalc. Save this in some folder.
function [fdly,tdly] = delaycalc(sig1,sig2)
i = 1;
j = 1;
fdly = zeros(1,266);
tdly = zeros(1,266);
while (i <= 12768000)
a = sig1(i:48000);
b = sig2(i:48000);
[cor,lag] = xcorr(a,b,'coeff');
[~,Il] = max(abs(cor));
lagdly = lag(Il);
tmdly = lagdly/48000;
i = i+48000;
j = j+1;
display(tmdly)
display(lagdly)
end
And then, change the path, and go to that folder. Now, you can call that function.
[sp1,fs1] = audioread('F:\Moodle\Summer18\sync porject\iitb recordings\01_SPK1_05_06_2017-09.wav');
[fdly,tdly] = delaycalc(sp1,fs1)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Import and Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!