With a 3D Matrix, How can I plot various 2D lineplots?

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?

2 Comments

I thought I could rearrange the matrix to a 6x100 one, is there a useful command for that?
Answer crossed your comment...see below

Sign in to comment.

Answers (1)

dpb
dpb on 24 Oct 2015
Edited: dpb on 24 Oct 2015
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.

Products

Asked:

on 24 Oct 2015

Commented:

dpb
on 24 Oct 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!