How to add a marker on a plot which will move according to a for loop in MATLAB GUIDE GUI?

8 visualizaciones (últimos 30 días)
Hello, I have been trying to add a marker to my plot but I have failed so far. This is the piece of code I am working on:
v = evalin('base','a matrix in my workspace which is 1000 by 1');
plot(v, 'Parent', handles.axes2);
for frames = 2:handles.frameCount-1
axes(handles.axes1);
imshow(handles.videoStruct(frames).cdata);
set(handles.text3, 'String', num2str(frames));
drawnow;
pause(1/handles.videoObject.FrameRate);
axes(handles.axes2);
hold on;
plot(frames, v(frames), '.r');
end
I have two axes in my gui. axes1 is used to display a video and has no problems. "v" is plotted in axes 2 before the video display and I would like to add a marker to it which will "move" according to which frame the for loop is at.
The last plot(frames, v(frames)... line works but plots points on axes2.
I have 2 options:
1. Somehow delete the last marker plot when the loop moves to the next iteration. Actually I don't want to prefer this because I will implement a slider to control that marker in the future.
2. Any easier way to create a marker on a plot without plotting it over again :)
Thank you very much from now on...

Respuestas (0)

Categorías

Más información sobre Specifying Target for Graphics Output en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by