|
Khanjan wrote:
> I am trying to plot a series of randomly generated line segments.
> However for some weird reason the following code is not plotting all of
> them. For example, if I were to set the num variable to 3, it only shows
> either 1 or 2 lines. If i set it to 6, it only displays 4 lines... I'm
> lost!! If you need more parts of my code please let me know. Thanks.
>
> for i = 1:num
> if (i == 1)
> axis([0 film_length 0 film_length]);
> hold all;
> end
> X{i} = originX(i,1):0.1:endX(i,1); Y{i} = slope(i,1) * X{i} +
> intercept(i,1);
If originX(i,1) is less than endX(i,1) then X{i} would be an empty
vector and no line would be drawn.
xstart = min(originX(i,1),endX(i,1));
xend = max(originX(i,1),endX(i,1));
X{i} = xstart:0.1:xend
> p = plot(X{i},Y{i});
> if (typeset(i,1) == 3)
> set(p,'Color','green');
> else
> set(p,'Color','red');
> end
> end
|