You can pass a vector as the first input to plot and a matrix (with a dimension which matches the size of the first vector) as the second input and it will create a plot for each pairing of the first vector and each row/column of the second input.
plot(X, Y, 'o')
This will automatically color each row of Y differently. If you’d like the entire plot to be the same color, you can specify the color when creating the plot
plot(X, Y, 'o', 'Color', 'black')
If, however, you want to use scatter, you’ll need to make sure that the two inputs have the same size. You can do this by applying repmat to X to make it the same size as Y
xx = repmat(X, size(Y, 1), 1);
scatter(xx(:), Y(:))
solved MatLab (presented data) [closed]


