Inside a MATLAB function I have built a matrix A, whose dimensions M and N are set as parameters of the function. I would like to plot all the columns of this matrix, given a vector of indices B with length M. Hence, I use these lines:
figure
plot(B,A)
I specified figure
as the MATLAB function returns more different plots.
My problem is that the program plots just two columns of the matrix with different colours (blue and violet). Where is my mistake?
Thank you for your attention.
Best Answer
go for
or
(depending on your rows/columns). You need to have same size matrices in plot.
Moreover, if
B
are just consecutive indexes, you may want to considerPlot(A)
(orPlot(A')
).