Plots in App Designer

1 回表示 (過去 30 日間)
Lars Duelund
Lars Duelund 2019 年 4 月 19 日
回答済み: Cris LaPierre 2019 年 4 月 20 日
Dear All
I am trying to write a simple data analysis program in the App designer, but i have probme with plotting my dat. I do the following:
  1. Load my data and plot them in a set of Axis. Works fine
  2. locate the Peaks in the data, with Peakfinder, and lable them with text. Work fine
  3. Now I need the area under the curve, så i fit a "baseline" to the data. Works fine with a button
  4. Now I plot the baseline into the same set of Axis (Within in the same "button") and it works fine the first time, and I have the two plot in Axis. BUT if i press the botton once more I only have the baseline (last plot). And then for evry second time i pres the button I have two plots, the other times I have one line
The following minimal code reproduces the behavour:
plot(app.UIAxes,app.data(:,1),app.data(:,2),'r');
hold(app.UIAxes);
plot(app.UIAxes,app.data(:,1),app.bsl,'g');
Any idea of what is going on or where I can lear more? It is clear what the problem is?
I use Matlab R 2019a on a WIN10 64 bit HP computer

採用された回答

Cris LaPierre
Cris LaPierre 2019 年 4 月 20 日
What behavior do you want? Just the two plots, or do you want to add the new plots to the old ones?
If you only want the two, the issue is you are not using hold correctly. This syntax toggles hold each time. If it's on, you are toggling it off and vice versa. I think you want to do this instead.
plot(app.UIAxes,app.data(:,1),app.data(:,2),'r');
hold(app.UIAxes,'on');
plot(app.UIAxes,app.data(:,1),app.bsl,'g');
hold(app.UIAxes,'off');

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by