MATLAB Answers

plot middle and end of an array

36 views (last 30 days)
cgenes
cgenes on 6 Jan 2017
Commented: cgenes on 7 Jan 2017
HI i want of plot the beginning and end of an array, leaving out the middle bit
something like . . . (here the comma doesn't work)
figure, plot(x(1:417,900:1000), y(1:417,900:1000))
is there an easy way to do this without splitting up the array?
thanks
Charlie

Accepted Answer

Adam
Adam on 6 Jan 2017
Edited: Adam on 6 Jan 2017
figure; plot(x([1:417,900:1000]), y([1:417,900:1000]))
You have to put your indices into an array, then you can use them as any other array of indices, irrespective of whether they are contiguous or not.
  2 Comments
cgenes
cgenes on 7 Jan 2017
ok thanks for this I don't want the point to be connected so i will try this

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!