MATLAB: How to link markers with lines in for loop

forlinestyleloopmarkerMATLABplot

When I plot a graph using for loop with Matlab 2015a as below:
The plot look like this:
I want to connect each 'n' with line as follows:
How to do that?
Thanks..

Best Answer

try to use this code
clear all
close all
clc
X=randint(5,100,[1 1000]);
Y=randint(1,100,[1 1000]);
for n=1:100
x=[];
y=[];
for k=1:5
x=[x X(k,n)];
y=[y Y(1,n)];
end
figure(1)
plot(y,x,'-o')
hold on
drawnow
end
Related Question