Selecting points from a graph in a GUI

2 visualizaciones (últimos 30 días)
B_Richardson
B_Richardson el 7 de Jul. de 2011
I have files of .avi movies typically 40 seconds in length each. I want to make a simple line plot of the movie. The y axis would be empty and the x axis would be the length of the movie in seconds.
y = 0
startOfMovie = 0
endOfMovie = 40
plot([startOfMovie, endOfMovie], [y, y])
Each movie is a set of 10 repetition exercise. I want the user to be able to use the plot interactively to identify the start and stop time of each rep in a GUIDE gui.
by default the plot should have a line that represents the movie in seconds:
______________________
seconds
then after the user identifies start and stop times of each rep the plot. For example, rep1 started at 5.5 secs and ended at 6.3 secs, Rep2 6.7 and 8.5, and so. So it will look like this:
___-___-___-____-___-____
With each dash representing a starting and end time of a rep. (it doesn’t have to be a dash, it could just be a colored section or something else) Is something like this possible in matlab? I also need to be able to store each of those data points.
So far I have:
figure;
y = 0
startOfMovie = 0
endOfMovie = 40
plot([startOfMovie, endOfMovie], [y, y])
k = waitforbuttonpress;
point1 = get(gca,'CurrentPoint'); % button down detected
finalRect = rbbox; % return figure units
point2 = get(gca,'CurrentPoint'); % button up detected
point1 = point1(1,1:2); % extract x and y
point2 = point2(1,1:2);
p1 = min(point1,point2); % calculate locations
offset = abs(point1-point2); % and dimensions
x = [p1(1) p1(1)+offset(1) p1(1)+offset(1) p1(1) p1(1)];
y = [p1(2) p1(2) p1(2)+offset(2) p1(2)+offset(2) p1(2)];
hold on
axis manual
plot(x,y,'r','linewidth',5) % draw box around selected region
So this allows for selection of one point. But I need to be able to select multiple points and save them.

Respuestas (0)

Categorías

Más información sobre Polar Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by