Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

'double' input argument not found using a function

Asked by Joachim

Joachim (view profile)

on 22 May 2013
Accepted Answer by Iain

Iain (view profile)

Hello,

I have got a int16 array (called allAudio) and would like to run the function 'findpeaks' on it. When I write pks = findpeaks(allAudio(1,:)), the error message says: "Error using findpeaks (line 59) Input arguments must be 'double'."

 I don't understand it... Any thoughts? 

0 Comments

Joachim

Joachim (view profile)

Products

No products are associated with this question.

1 Answer

Answer by Iain

Iain (view profile)

on 22 May 2013
Accepted answer

findpeaks only operates on numbers that are 64 bit floating point numbers (they're called doubles).

Convert your 16bit integers to double with the function "double".

double_allAudio = double(allAudio);

1 Comment

Joachim

Joachim (view profile)

on 22 May 2013

Great!

here's the last bit of the code I wrote to make it work (Had to transpose the matrix)

allAudio_transp=allAudio.';
double_allAudio = double(allAudio);
[pks,locs] = findpeaks(double_allAudio(1,:))
Iain

Iain (view profile)

Contact us