Find peaks of plot in UIAxes appdesigner

조회 수: 11 (최근 30일)
Sam Quick
Sam Quick 2019년 5월 21일
답변: Astha Singh 2019년 6월 3일
Dear everybody
I'm working on an app in appdesigner of matlab for a school project where we get a lot of data from an excel file, which we plot using uiaxes. The next step is to locate all the peaks of this plot and highlight them on the plot ( see picture below). We are allready able to find the peaks, but when trying to display them on the excisting window, it doen't work because it opens up a new figure... We tried to work wit the hold on function but it didn't work. This is the code we currently use: = xlsread(app.fileName, -1);
findpeaks(, 'MinPeakDistance', 25);

답변 (1개)

Astha Singh
Astha Singh 2019년 6월 3일
As per the workflow, 'hold on' should let the peak points be drawn on the same axis. For a simple example, try running the following in the MATLAB Command Window:
data = [25 8 15 5 6 10 10 3 1 20 7];
hold on;
This lets the original plot and the peaks to be in the same axis.
Also, as the 'findpeaks' function can return the location of the peak points, you can also plot the peaks as per the following manner:
data = [25 8 15 5 6 10 10 3 1 20 7];
hold on;
[pks,locs] = findpeaks(data);


Help CenterFile Exchange에서 Descriptive Statistics and Visualization에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by