How can I copy the value of points around the result of a specific function?
1 view (last 30 days)
Show older comments
How can I copy the value of points around the result of a specific function? E.g. Let us suppose I am using findpeaks to find the peaks of a given set of data, but I also want the code to copy the value of the point following the peak (the next one). Is there a way to do so?
0 Comments
Accepted Answer
YT
on 15 Dec 2017
I don't know if I understand the question correctly, but did you mean something like this (using findpeaks() as example)
data = rand([1 10]);
plot(data)
[pks,locs] = findpeaks(rand([1 10]));
disp('Current locations / values:');[locs;pks]
%Current locations / values:
%ans =
%
% 4.0000 7.0000
% 0.3520 0.7838
disp('Next locations / values (+1)');[(locs+1);data(locs+1)]
%Next locations / values (+1)
%ans =
%
% 5.0000 8.0000
% 0.1528 0.0175
2 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!