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 vues (au cours des 30 derniers jours)
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;

Réponses (1)

Walter Roberson
Walter Roberson le 25 Juin 2018
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.)

Catégories

En savoir plus sur Scatter Plots dans Help Center et File Exchange

Produits


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by