With a 3D Matrix, How can I plot various 2D lineplots?
Show older comments
I have a 3D matrix, 3x2x100 and I want to plot 6 different lineplots (x-axis would be the 100). The six line plots would be at each value of the (3x2) part of the matrix, and run along the(x100) part of the matrix. How can I do this?
Answers (1)
plot(reshape(data,6,[]).')
will be the six in order from 1,1 to 3,2 by column order; iow each of the first column followed by second and third in sequence plotted versus observation number. If you have a given x vector or 100 observations, then use it as normal in plot argument list, of course.
NB: the transpose to turn the rows into columns which is what plot presumes is orientation for different variables.
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!