Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Data may not have more than 2 dimensions plotting

Subject: Data may not have more than 2 dimensions plotting

From: Gule Saman

Date: 18 Mar, 2009 11:53:01

Message: 1 of 3

hi

 i am getting the following error although both polang and z have 10 elements in each. But when it gets to plotting it gives this error.

??? Error using ==> plot
Data may not have more than 2 dimensions

Error in ==> refractive_index_estimation at 108
            plot(polang(:),z(x,y,:),'bo');

Subject: Data may not have more than 2 dimensions plotting

From: Jonathan

Date: 18 Mar, 2009 12:23:01

Message: 2 of 3

"Gule Saman" <gulesaman@gmail.com> wrote in message <gpqnat$srq$1@fred.mathworks.com>...
> hi
>
> i am getting the following error although both polang and z have 10 elements in each. But when it gets to plotting it gives this error.
>
> ??? Error using ==> plot
> Data may not have more than 2 dimensions
>
> Error in ==> refractive_index_estimation at 108
> plot(polang(:),z(x,y,:),'bo');

Because "z" was initially a 3-D matrix, you have to use squeeze to compress it down to a column vector to use in plot (this removes any dimensions that only have one value):

plot(polang(:),squeeze(z(x,y,:)),'bo');

-Jonathan

Subject: Data may not have more than 2 dimensions plotting

From: Gule Saman

Date: 18 Mar, 2009 14:54:01

Message: 3 of 3

thnx that worked
"Jonathan " <suever@gatech.edu> wrote in message <gpqp35$r0s$1@fred.mathworks.com>...
> "Gule Saman" <gulesaman@gmail.com> wrote in message <gpqnat$srq$1@fred.mathworks.com>...
> > hi
> >
> > i am getting the following error although both polang and z have 10 elements in each. But when it gets to plotting it gives this error.
> >
> > ??? Error using ==> plot
> > Data may not have more than 2 dimensions
> >
> > Error in ==> refractive_index_estimation at 108
> > plot(polang(:),z(x,y,:),'bo');
>
> Because "z" was initially a 3-D matrix, you have to use squeeze to compress it down to a column vector to use in plot (this removes any dimensions that only have one value):
>
> plot(polang(:),squeeze(z(x,y,:)),'bo');
>
> -Jonathan

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us