mugetsu
mugetsu

Reputation: 4408

how to truncate dataset plot

Assume I have a data set plot vector with 2 columns(x,y) However, I do not want to plot out the entire set, but truncate the plot from x1 to x2, some set x value that I know. How would I do this?

Upvotes: 1

Views: 2683

Answers (1)

bla
bla

Reputation: 26069

Two options I can think of, if you know the indices of the range, then:

plot(x(x1:x2),y(x1:x2)); % here x1 and x2 are indices, not values

Otherwise you can always:

range=find(x>x1 & x<x2); % here x1 and x2 are actual values, you can use any other condition needed...
plot(x(range),y(range))

Upvotes: 1

Related Questions