I am working on a UI that has a mesh plot and a scatter point that updates depending on the value, how do I allow the scatter point to update?
조회 수: 2 (최근 30일)
이전 댓글 표시
I am making a UI to plot a mesh grid. I use 'hold on' to allow me to plot a scatter point on top of the grid. The user uses sliders or the editable text box to insert values that should update a point that corresponds to the red point. I have attached an image of what it looks like, however I cannot figure out how to update the red point. I have attached the beginning code to plot it as an example of how I am doing it. What I think I want to do is to update the entire plot of the mesh and scatter point again but I cannot think of how to update the mesh with the scatter again. I am not using GUIDE or the app designer. Thank you for any help.
% create the figure in windowed position
F.fh = figure('Name','Airfoil Plot','NumberTitle','off');
F.fh.WindowState = 'maximized';
% function for the plotting
F.fcn = @(Angle,Speed) griddata(xq,yq,zq,F.Angle,F.Speed);
% create plot of mesh that they choose AoA and V from
F.ax = axes('position',[.1 .3 .7 .7]);
F.ms = mesh(xq,yq,zq);
hold on;
F.red = scatter3(F.Angle,F.Speed,F.z,50,[1 0 0],'filled');
hold off;
view([20 35]);
rotate3d on;
댓글 수: 2
답변 (1개)
Walter Roberson
2018년 6월 25일
If "update a point that corresponds to the red point" is intended to refer to F.red, then instead of redrawing anything, to update the location, set the XData, YData, Zdata properties of F.red to correspond to the new location. (And call drawnow() afterwards to make the change visible.)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Scatter Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!