Plot using the App Designer
조회 수: 3 (최근 30일)
이전 댓글 표시
Fuwad Abdul Muyeed
2021년 10월 4일
답변: Shravan Kumar Vankaramoni
2021년 10월 7일
I have a certain data of approximately 100 data points stored in a variable in 2 columns. Suppose data=[x,y] (2 columns,100 rows).
Under the App Designer, I want to extract first 20 data points and plot them. Upon checking the plot, I want to select the Next button and view the plot for the next 20 data points. I have set up the layout in the App Designer but I would like to know how and where to add the code such that it will extract the points from existing variable 'data' and plot them. I am using the 3 panel layout.
댓글 수: 0
채택된 답변
Shravan Kumar Vankaramoni
2021년 10월 7일
Hi,
You need to maintain a local variable to keep a count on the number of points already read. Below code demonstrates plotting the graph with next 20 points on clicking next button. "app.Data" is your data and "app.Count" counts the number of points read. Below function is the callback for next button.
function NextButtonPushed(app, event)
x = app.Data(app.Count:app.Count+19,1);
y = app.Data(app.Count:app.Count+19,2);
%passing the axes on which graph is displayed
plot(app.UIAxes,x,y);
app.Count = app.Count + 20;
if app.Count > 100
app.Count = 1;
end
end
Attached the app file for reference. Hope this helps
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!