Drawing line segments

Shaun Jackman sjackman at bcgsc.ca
Tue Jun 17 18:06:15 CDT 2008


Bill Denney wrote:
> Hi Shaun,
> 
> If you do
> 
> plot ([1;2;nan;4;5], [1;2;nan;4;5])
> 
> you get broken lines where the nan values are.  For your problem, you 
> could do something like (assuming that data is your 4 column matrix):
> x = reshape ([data(:,1:2) nan(rows(data),1)]', [], 1);
> y = reshape ([data(:,3:4) nan(rows(data),1)]', [], 1);
> plot (x,y)
> 
> Have a good day,
> 
> Bill

Worked like a charm! Thanks, Bill.

Cheers,
Shaun


More information about the Help-octave mailing list