MATLAB Answers


'double' input argument not found using a function

Asked by Joachim
on 22 May 2013


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? 


Log in to comment.


No products are associated with this question.

1 Answer

Answer by Iain
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


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

double_allAudio = double(allAudio);
[pks,locs] = findpeaks(double_allAudio(1,:))

Log in to comment.

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

MATLAB Academy

New to MATLAB?

Learn MATLAB today!