MATLAB: How to have different marker sizes for different points in 1 line plot

2-d line plot

Is there any way to set different marker sizes for different points in 1 line plot by an array of marker sizes?
For example I have 4 points in 1 line plot, could I do something like this: h = plot… set(h, 'MarkerSizes', [1 2 3 4])
Or I have to plot the markers separately from the lines and have 4 plots for 4 points?
Thanks.

Best Answer

x=1:4
y=[10 20 30 40]
plot(x,y)
A=[2 4 6 8] %sizes
hold on
for k=1:numel(A)
h=scatter(x(k),y(k),'marker','o','linewidth',A(k))
end