I would like to use vectarrow function to draw vectors:
The code below defines a function fx for the x and y coordinates (x1 x2 x3 …) of the vectors. I am confused how to get back the numerical values of fx and fy (instead of 'x1' -> 2, 'x2' -> 4…).
x1 = 2; x2 = 4; x3 = 5; x4 = 7;y1 = 2; y2 = 4; y3 = 5; y4 = 7;v= [1 2 3 4]; % the order changes
vv = length(v); fx = cell(vv, 1);for i=1:vv fx{i} = strcat('x', num2str(v(i))); fy{i} = strcat('y', num2str(v(i)));end%plot
for j = 1:length(v)-1 vectarrow([char(fx(j)); char(fy(j))], [char(fx(j+1)); char(fy(j+1))]); % does not work
hold onendhold off
Best Answer