Is the 'findpeaks' function available only in 2014b ?
Show older comments
I am getting this error "Undefined function 'findpeaks' for input arguments of type 'double' " while using 'findpeaks' in Matlab 2014a
Accepted Answer
More Answers (1)
geotocho
on 10 Aug 2017
0 votes
I beleive the issue you have, or may have resolved by now, is caused by the findpeaks input arguments. findpeaks has changed since MATLAB2014a. Currently findpeaks accepts a vector of indicies as the second argument for which [~,locs] is identified by. The 2014a version does not handle this index array as the second function argument. 2014a is looking for a string such as 'Tolerance' for the second input. 2014a findpeaks will output locs which may not precisely be the locs you want if you search only a portion of your signal for peaks.
To work around this and output the peak locs identified by 2014a I modified my code below:
% Find Peak Change in Covariance - Evaluated 99% Probability
% 2014b or later Version
[~,peakIx]=findpeaks(qCovAvg(100:end),Ix(100:end),'MinPeakHeight',q99);
% 2014a or Earlier Version
[~,peakIx] = findpeaks(qCovAvg(100:end),'MinPeakHeight',q99);
dumIx = Ix(100:end);
peakIx = dumIx(peakIx);
% Hope you find this helpful
Categories
Find more on Descriptive Statistics in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!