From: Max on
As an early EE major, I'm very new to Matlab so go easy on me. I have
a data set in the form of an excel document. The first column is the X
values, 2nd-13th colum are each Y 'points' and under those columns are
the Z values. How should I go about plotting a 3D mesh with these
data? Thanks.

From: spok on
Hi,

try this : (consider A your matrix from excel)

[X,Y] = meshgrid(A(:,1),A(1,2:13))
Z = A(2:end,2:13);
mesh(X,Y,Z)

or surf(X,Y,Z) ...

or help mesh ! :-)

S.

From: Max on

spok wrote:
> Hi,
>
> try this : (consider A your matrix from excel)
>
> [X,Y] = meshgrid(A(:,1),A(1,2:13))
> Z = A(2:end,2:13);
> mesh(X,Y,Z)
>
> or surf(X,Y,Z) ...
>
> or help mesh ! :-)
>
> S.

Thanks for the speedy reply!
Well, lets call my A data, I ran

[X,Y] = meshgrid(data(:,1),data(1,2:14))
Z = data(2:end,2:14);
mesh(X,Y,Z)

It gave me:

??? mesh(X,Y,Z) [X,Y] = meshgrid(data(:,1),data(1,2:14))
|
Error: Unbalanced or misused parentheses or brackets.

PS. It's no longer 13 columns, it's 14, and I've changed it in the code.

From: Max on
I've fiddled around with it some more, now the errors are just:

Warning: Matrix dimensions must agree, not rendering mesh.

From: J?r?me on
Hi,

here is a small example :

M=[0:5; (1:5)' rand(5)]

[X,Y]=meshgrid(M(2:end,1),M(1,2:end));

surf(X,Y,M(2:end,2:end))

J?r?me