Parse Error at '['

3 visualizaciones (últimos 30 días)
Abhiraj Kanse
Abhiraj Kanse el 22 de Mayo de 2018
Comentada: Guillaume el 22 de Mayo de 2018
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 comentarios
Jos (10584)
Jos (10584) el 22 de Mayo de 2018
Please copy the exact error message you get.
Guillaume
Guillaume el 22 de Mayo de 2018
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 [.

Iniciar sesión para comentar.

Respuestas (1)

KSSV
KSSV el 22 de Mayo de 2018
[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 comentarios
Abhiraj Kanse
Abhiraj Kanse el 22 de Mayo de 2018
[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 el 22 de Mayo de 2018
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)

Iniciar sesión para comentar.

Categorías

Más información sobre Data Import and Analysis en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by