For Programmers: Free Programming Magazines  


Home > Archive > Matlab > November 2005 > Error with Surf Shading









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Error with Surf Shading
OliH

2005-11-28, 7:07 pm

Hi,

In the MATLAB Help it says that if I define a surface using
x(i,j),y(i,j) I can define the colour matrix C(i,j) as having one
less row and column than the x and y matrices. This is because if the
shading is set to flat or faceted, there are always 1 less cell
centres than vertices on any one edge. However, when I try this, I
get the following error:

??? Error using ==> surface
Matrix dimensions must agree.

Error in ==> C:\MATLAB6p5\toolbox\matlab\graph3d\surf
.m
On line 68 ==> hh = surface(varargin{:});

Error in ==> C:\Documents and Settings\MBGBLORH\My Documents\PhD
Work\3D Case Generation\Temp Data Files\Plane.m
On line 125 ==> surf(XVN,YVN,PHI)

but...

size(XVN)=[19 73]
size(YVN)=[19 73]
size(PHI)=[18 72]

....so, as long as the shading is not interp, which it isn't, this
should be ok.

Are there any suggestions as to why I get this error?

Thanks in advance,

Oli
Glenn Kightley

2005-11-29, 7:07 pm

Hi OliH

I usually use surf(x,y,z,c) to give the third z coordinate as well,
otherwise it'll read in c(i,j) as you z ordinate and then have
problems. Set z=zeros(19,73); and see of this helps.

OliH wrote:
>
>
> Hi,
>
> In the MATLAB Help it says that if I define a surface using
> x(i,j),y(i,j) I can define the colour matrix C(i,j) as having one
> less row and column than the x and y matrices. This is because if
> the
> shading is set to flat or faceted, there are always 1 less cell
> centres than vertices on any one edge. However, when I try this, I
> get the following error:
>
> ??? Error using ==> surface
> Matrix dimensions must agree.
>
> Error in ==> C:\MATLAB6p5\toolbox\matlab\graph3d\surf
.m
> On line 68 ==> hh = surface(varargin{:});
>
> Error in ==> C:\Documents and Settings\MBGBLORH\My Documents\PhD
> Work\3D Case Generation\Temp Data Files\Plane.m
> On line 125 ==> surf(XVN,YVN,PHI)
>
> but...
>
> size(XVN)=[19 73]
> size(YVN)=[19 73]
> size(PHI)=[18 72]
>
> ...so, as long as the shading is not interp, which it isn't, this
> should be ok.
>
> Are there any suggestions as to why I get this error?
>
> Thanks in advance,
>
> Oli

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com