Parse Error at '['

조회 수: 3 (최근 30일)
Abhiraj Kanse
Abhiraj Kanse 2018년 5월 22일
댓글: Guillaume 2018년 5월 22일
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
Jos (10584)
Jos (10584) 2018년 5월 22일
Please copy the exact error message you get.
Guillaume
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
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
Abhiraj Kanse
Abhiraj Kanse 2018년 5월 22일
[sp1,fs1] = audioread('F:\Moodle\Summer18\sync porject\iitb recordings\01_SPK1_05_06_2017-09.wav');
[ar1,fs4] = audioread('F:\Moodle\Summer18\sync porject\iitb recordings\04_ARRAY1_05_06_2017-09.wav');
ar11 = ar1.*(100);
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
Now it shows this error: Line 5: FUNCTION keyword use is invalid here. This might cause later message about END. Line 5: Parse error at ']': usage might be invalid MATLAB syntax
Line 5: Parse error at ')': usage might be invalid MATLAB syntax
KSSV
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 CenterFile Exchange에서 Data Import and Analysis에 대해 자세히 알아보기

제품


릴리스

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by