This is my function 1:
function Speech_Recognition_Project(filename)
global voice;
voice=audioread(filename);
global x;
x=voice;
x=x';
x=x(1,:);
x=x';
m1 = Input_File('Input1.wav');
m2 = Input_File('Input2.wav');
m3 = Input_File('Input3.wav');
m4 = Input_File('Input4.wav');
m5 = Input_File('Input5.wav');
This is function 2:
function Input_File(filename)
global y;
y=audioread(filename);
y=y';
y=y(1,:);
y=y';
z=xcorr(x,y);
global m;
m=max(z);
l=length(z);
t=-((l-1)/2):1:((l-1)/2);
subplot(3,2,1);
plot(t,z);
I want value of m to stored in m1.
When I write Speech_Recognition_Project('Test.wav'). It shows me following error:
>> Speech_Recognition_Project('utsav.wav')
Error using Input_File
Too many output arguments.
Error in Speech_Recognition_Project (line 12)
m1 = Input_File('utsav.wav');
Please help me to figure out where I am going wrong.

 Respuesta aceptada

DGM
DGM el 9 de Abr. de 2021
Your function definition
function Input_File(filename)
specifies that this function takes one input argument and has zero output arguments. In order to get something out of it, you need to change your function definition to have an output argument. Consider the example:
function totallybig=biggerthanfive(inputnumber)
totallybig=(inputnumber>5);
end
The output argument 'totallybig' is in the function definition, and somewhere in the scope of the function, a value is assigned to it.
That's how you handle basic sharing of variables. Avoid using globals for everything ... or anything. If you need things within another function, pass them as arguments.

Más respuestas (0)

Categorías

Más información sobre Audio Plugin Creation and Hosting en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 9 de Abr. de 2021

Comentada:

el 9 de Abr. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by