I would like to plot vertical lines at several specified points (x axis) on a graph. Each point is the onset of a stimulus. I specify the number of these points and where they occur with the following:
stimulus = zeros([1 20]);
prompt = ['how many stimuli in this experiment? '];
stimnumber = input(prompt);
query=['when is onset of stim number ',num2str(stim)];
prompt = '? ';
This sets up an array ("stimulus") with up to 20 stimulus points I can specify.
Now how can I access "stimulus" to draw the vertical lines? I was able to do this with with a super klugey script such as:
y = [0 5];
x = [stimulus(1,1), stimulus(1,1)];
x = [stimulus(1,2), stimulus(1,2)];
x = [stimulus(1,3), stimulus(1,3)];
x = [stimulus(1,20), stimulus(1,20)];
Surely there is a cleaner way to do this with a for loop, but I just can't get it.
Here's what it should look like, for instance if I specify 3 stimuli at x=300,400, and 450: