Plotting Matrix points: 2
显示 更早的评论
Given a matrix:
B
ans =
30.7805 28.7527 25.7110 23.6832 19.6268 17.5949 14.5547 11.5147 8.4725 5.4313
29.7667 27.7333 24.6923 21.6549 18.6114 15.5708 12.5285 9.4806 7.4582 4.4159
B.'
ans =
30.7805 29.7667
28.7527 27.7333
25.7110 24.6923
23.6832 21.6549
19.6268 18.6114
17.5949 15.5708
14.5547 12.5285
11.5147 9.4806
8.4725 7.4582
5.4313 4.4159
I am trying to plot the data as shown in this image:
I am trying to plot the 1st column as the orange points and the 2nd column as the blue points. The time between the points form a small box. The only axes I'm interested in is the X which will be composed of the overall time of the video. I am attempting to do this in a GUIDE axes. Eventually I want the user to be able to select the points and add labels.
Any advice in accomplishing this will be greatly appreciated!
采纳的回答
更多回答(2 个)
Fangjun Jiang
2011-7-20
B=[30.7805 28.7527 25.7110 23.6832 19.6268 17.5949 14.5547 11.5147 8.4725 5.4313
29.7667 27.7333 24.6923 21.6549 18.6114 15.5708 12.5285 9.4806 7.4582 4.4159];
h=line(B,zeros(2,10));
hold on;
plot(B(1,:),zeros(10,1),'y*');
plot(B(2,:),zeros(10,1),'bo');
set(h,'LineWidth',2,'color','red')
4 个评论
B_Richardson
2011-7-20
B_Richardson
2011-7-20
Fangjun Jiang
2011-7-20
Well, you changed the size of your B from previous one (10x2 vs. 2x10).
B_Richardson
2011-7-20
B_Richardson
2011-7-20
0 个投票
3 个评论
Jan
2011-7-20
I do not see a reason to translate this to a complicated GUI, which would create the same code in the ideal case.
B_Richardson
2011-7-20
Fangjun Jiang
2011-7-20
Then, you'll probably have a button in your GUIDE GUI. In its callback function, you'll get the data B, create an axes and the use the above code to create the figure.
类别
在 帮助中心 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!