From: Erik L on
Hello,

I have a three dimensional array, tried plot3(matrix) but gives the following error.
?? Error using ==> plot3
Data may not have more than 2 dimensions

Is there a way to plot three dimensional array(matrix).

thanks
From: sscnekro on
> I have a three dimensional array, tried plot3(matrix) but gives the following error.
> ?? Error using ==> plot3
> Data may not have more than 2 dimensions

Mhmm, I guess it's because you should use 3 input arguments with plot3(). For instance, if your matrix M is N x 3, do:
plot3(M(:,1), M(:,2), M(:,3))
From: sscnekro on
> Mhmm, I guess it's because you should use 3 input arguments with plot3(). For instance, if your matrix M is N x 3, do:
> plot3(M(:,1), M(:,2), M(:,3))

Sorry, sorry, typos. With either plot3() or mesh() incl. related you need 3 inputs, but: any of those inputs need to be 2D .. whereas you were asking how to plot a 3D M matrix. In that even, I don't know .. maybe you'd see a way to refer to 2D parts of the 3D matrix and plote those.
From: Walter Roberson on
Erik L wrote:

> I have a three dimensional array, tried plot3(matrix) but gives the
> following error.
> ?? Error using ==> plot3
> Data may not have more than 2 dimensions
>
> Is there a way to plot three dimensional array(matrix).

What do the dimensions _mean_ ?

If it is a 3 dimensional matrix of values, then you are trying to plot 4
dimensions, which is not directly possible. It would be possible to build a
solid 3D grid of values and plot the values as colors (but not simple), but if
you do that then you would have to use transparency in order to be able to
see part-way inside (and should not expect to be able to see very far inside.)

If you are trying to do voxel imaging, then unfortunately Matlab is not very
suited for that.
From: Erik L on
dear walter,

Thanks for reply.
I have a matrix A(5,6,9) meaning that it has got separate matrices each having 5 rows and 6 columns for each third dimension [1....to 9].
like A(:,:,1)......A(:,:,9)
I have updated the matrix A according to my algorithm and now want to plot the comparative values column-wise of all matrices for the third dimension[1,,,9].

I should see something like:

on X-axs.....values from 1 to 9( the third dimension)
on y-axs.....the weights of the values inside the matrices
on z-axs.....the values 1 to 6 which are the columns of matrices

thanks

Walter Roberson <roberson(a)hushmail.com> wrote in message <humbco$c2o$1(a)canopus.cc.umanitoba.ca>...
> Erik L wrote:
>
> > I have a three dimensional array, tried plot3(matrix) but gives the
> > following error.
> > ?? Error using ==> plot3
> > Data may not have more than 2 dimensions
> >
> > Is there a way to plot three dimensional array(matrix).
>
> What do the dimensions _mean_ ?
>
> If it is a 3 dimensional matrix of values, then you are trying to plot 4
> dimensions, which is not directly possible. It would be possible to build a
> solid 3D grid of values and plot the values as colors (but not simple), but if
> you do that then you would have to use transparency in order to be able to
> see part-way inside (and should not expect to be able to see very far inside.)
>
> If you are trying to do voxel imaging, then unfortunately Matlab is not very
> suited for that.