line plot of events with value

6 views (last 30 days)
Mech Princess
Mech Princess on 26 Oct 2012
I want to plot TEST values (amplitude) against the given time in TEST_TS. Then I want to plot vertical lines at given times of ttss.
example code is given below
TEST_TS = (1:10)';
TEST = [5 -1 8 10 -4 -2 7 0 -2 1]';
ttts = [2.5 3 9.2 1 8]';
for i=1:10
line([TEST_TS(i) TEST_TS(i)],[TEST(i,1) 0]); hold on
yL = get(gca,'YLim');
line([ttts ttts],yL,'Color','r');
Now my issue is that when my data vector is long (200,000 points) it takes forever for the plot to come out. I have several such plots in my code.
If I plot the first using "stem" it gives an error when I try to plot ttss using plot or line.
Does anyone know an efficient way to do this? Thanks

Answers (0)


Community Treasure Hunt

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

Start Hunting!