plot Dynamic horizontal line
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Martin Tambour
el 14 de Jul. de 2020
Comentada: Martin Tambour
el 15 de Jul. de 2020
Hello,
I need to visualize a watertank in Matlab. I have the height of the water in a 1x1000 array and it needs to change over the time of 1:1000.
Also I need a steady yline that doesn't change.
Is there a build in funktion? can I use the addpoints funktion?
5 comentarios
Respuesta aceptada
Steven Lord
el 14 de Jul. de 2020
You want something like this?
% Sample data
x = 0:360;
y = sind(x);
% Create the sine curve with one marker
h = plot(x, y, 'Marker', 'o', 'MarkerIndices', 1);
% Create the horizontal line
L = yline(y(1));
for whichPoint = 2:length(y)
% Change the height of the horizontal line
L.Value = y(whichPoint);
% Change which point in the sine curve has the marker
h.MarkerIndices = whichPoint;
% Give MATLAB a chance to redraw the screen
drawnow expose
end
Más respuestas (0)
Ver también
Categorías
Más información sobre Creating, Deleting, and Querying Graphics Objects en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
