Reputation: 25
I am working in matlab and I have 2 arrays with the following points
qazX = 5 5
6 47
7 38
8 29
9 10
10 31
qazY = 15 16
16 57
17 28
18 49
19 30
20 25
I want to connect the 2 arrays. For example I want the line between (5,5) and (15,16), and then a separate line from (6,47) to (16,57) and so on.
I have tried the following code but none seem to work. Any help is much appreciated.
plot(qazX,qazY)
plot(qazX(:,1),qazX(:,2),qazY(:,1),qazY(:,2))
plot([qazX(:,1),qazY(:,1)],[qazX(:,2),qazY(:,2)])
Upvotes: 2
Views: 78
Reputation: 45741
You were very close:
plot([qazX(:,1),qazY(:,1)]',[qazX(:,2),qazY(:,2)]')
Upvotes: 4