how to connect points where the interval has no values?

Dear Sir,
May I know how to connect points together where the interval between any two points have no values?
ie my data set: test1 =
1 2
2
3
4 4
my program: plot(test1(:,1), test1(:,2))
the results: only points are plotted but they are not joined. I tried interpolation, but cant because the interval is NaN. How do we join the points to form continuous line?
thanks for your kind help.

Answers (2)

Is test a cell array? What you show is not possible for a regular array. Please elaborate.
Dear Mr Matt,
test1 is a data set. we can imagine the first column as x-axis and second column as y-axis. in the first column, we have [1 2 3 4] and second column as having a value that corresponds to a x-value. ie 2 correspond to 1st element of x-axis and 4 correspond to 4th element of x-axis.
yes i did not input them as a regular array directly. I had an excel sheet with the above setting and read them off to a variable in Matlab.
Why i do this is because to model events happening at intervals. I have another set of data(observations) that occurs at all discrete times. Hence I would like to see a graph with the observations on top and events below. So why i link the events up is to see the trend clearly and how it affects the observations
hope its clearer now. its a tough one.
thank you for your help.

Asked:

on 3 Nov 2012

Community Treasure Hunt

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

Start Hunting!