MATLAB: How to plot vectors within in a for loop using a variable

column vectorplot

I have some coloumn vectors in my workspace named x1, x2, x3 and y1, y2, y3
I want to make a for loop to plot x,y for each of these, im not sure of how the syntax should be but would something like this be possible:
for i = 1:3
plot (x(i), y(i)) *** not sure how this line should look (i want to plot x1 vs y1 then in the second loop plot x2 vs y2 etc…)
hold on
end

Best Answer

x = {x1, x2, x3} ;
y = {y1, y2, y3} ;
for i = 1:3
plot(x{i} , y{i}) ;
hold on
end