hamed
hamed

Reputation: 85

Unexpected MATLAB operator error when I initialize my function

I write a MATLAB function to do some processing in audio file and finally drawing the graph of audio.

input_sequence is a path of audio file.

function []= quantizer_DSP(input_sequence, B)
[y, Fs] = audioread('input_sequence'); 
MinRange = -1;
MaxRange = +1; 
QuantizerLevel = 2^B;
SignalRange = (MaxRange-MinRange)/(QuantizerLevel); 
y = y/SignalRange;
y = round(y);
y = y*SignalRange;

x=5000:5500;
plot(x,y(5000:5500),'r:');

end

When I use this function and use my audio file this error occurs:

quantizer_DSP(F:\HAMED\Daneshgah\Term8\DSP\Majid~\majid\1,4);
                ↑
Error: Unexpected MATLAB operator.

Upvotes: 0

Views: 54

Answers (1)

Cris Luengo
Cris Luengo

Reputation: 60444

The error message indicates that the error occurs in the line where you call the function, not inside the function itself. The function is never loaded.

You need to quote the path that you use as an argument:

quantizer_DSP('F:\HAMED\Daneshgah\Term8\DSP\Majid~\majid\1',4);

Upvotes: 1

Related Questions