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:
Meshgrid error?

Subject: Meshgrid error?

From: Carp Fisher

Date: 7 Mar, 2009 22:33:29

Message: 1 of 10

I'm trying to use a meshgrid in some code I'm working on and I keep getting errors. I finally copied this code out of the Matlab help:

[X,Y] = meshgrid(1:3,10:14)

Even this one line of code errors out for me. I'm using 2007a. Any suggestions?

Subject: Meshgrid error?

From: John D'Errico

Date: 7 Mar, 2009 22:53:01

Message: 2 of 10

Carp Fisher <bmjim@gmail.com> wrote in message <17837527.1236465265136.JavaMail.jakarta@nitrogen.mathforum.org>...
> I'm trying to use a meshgrid in some code I'm working on and I keep getting errors. I finally copied this code out of the Matlab help:
>
> [X,Y] = meshgrid(1:3,10:14)
>
> Even this one line of code errors out for me. I'm using 2007a. Any suggestions?

1. Don't name variables something like meshgrid.

2. Don't name your functions or scripts with the name
meshgrid.

To know which you have done, you would actually have
had to tell us what the error was. Silly question, I know
but it might have been of some help.

Or, just type this:

which meshgrid -all

It will tell you where the conflict lies.

John

Subject: Meshgrid error?

From: Matt Fig

Date: 7 Mar, 2009 23:06:02

Message: 3 of 10

Carp Fisher <bmjim@gmail.com> wrote in message <17837527.1236465265136.JavaMail.jakarta@nitrogen.mathforum.org>...
> I'm trying to use a meshgrid in some code I'm working on and I keep getting errors. I finally copied this code out of the Matlab help:
>
> [X,Y] = meshgrid(1:3,10:14)
>
> Even this one line of code errors out for me. I'm using 2007a. Any suggestions?

I suggest you always post the error message when inquiring about an error.

Subject: Meshgrid error?

From: Carp Fisher

Date: 7 Mar, 2009 23:20:47

Message: 4 of 10

John, thanks for the response. I guess at this point, I'm just trying to get meshgrid to work at all. When I run this:

theta = 5:15;
offset = 1.5:1:3.5;
[theta offset] = meshgrid(theta,offset);

I get this error:

??? Attempt to execute SCRIPT meshgrid as a function:
C:\Documents and Settings\Kim\Desktop\meshgrid.m

Error in ==> meshgrid at 3
[theta offset] = meshgrid(theta,offset);


Do you have any suggestions?

Subject: Meshgrid error?

From: Matt Fig

Date: 7 Mar, 2009 23:40:03

Message: 5 of 10

Kim,

You have a file named meshgrid on your desktop. If you are trying to use the built-in Matlab function, also named meshgrid, you will have to get rid of the one on your desktop first. You can rename the file or move it to somewhere that Matlab cannot see it. That is why John said you shouldn't have a file named the same name as a built-in function.

Subject: Meshgrid error?

From: Carp Fisher

Date: 7 Mar, 2009 23:42:38

Message: 6 of 10

Sorry about that. When I run this:

[X,Y] = meshgrid(1:3,10:14)

I get this error:

??? Attempt to execute SCRIPT meshgrid as a function:
C:\Documents and Settings\Kim\Desktop\meshgrid.m

Error in ==> meshgrid at 1
[X,Y] = meshgrid(1:3,10:14)

Subject: Meshgrid error?

From: Bruno Luong

Date: 8 Mar, 2009 00:09:01

Message: 7 of 10

Carp Fisher <bmjim@gmail.com> wrote in message <33231975.1236469388537.JavaMail.jakarta@nitrogen.mathforum.org>...
> Sorry about that. When I run this:
>
> [X,Y] = meshgrid(1:3,10:14)
>
> I get this error:
>
> ??? Attempt to execute SCRIPT meshgrid as a function:
> C:\Documents and Settings\Kim\Desktop\meshgrid.m

Just rename (or delete) the above file.

Bruno

Subject: Meshgrid error?

From: Faraz Afzal

Date: 8 Mar, 2009 00:17:01

Message: 8 of 10

Carp Fisher <bmjim@gmail.com> wrote in message <33231975.1236469388537.JavaMail.jakarta@nitrogen.mathforum.org>...
> Sorry about that. When I run this:
>
> [X,Y] = meshgrid(1:3,10:14)
>
> I get this error:
>
> ??? Attempt to execute SCRIPT meshgrid as a function:
> C:\Documents and Settings\Kim\Desktop\meshgrid.m
>
> Error in ==> meshgrid at 1
> [X,Y] = meshgrid(1:3,10:14)



Hello Carp Fisher.....

here is yourmistake..
when u execute u pop up with this error

??? Attempt to execute SCRIPT meshgrid as a function:
C:\Documents and Settings\Kim\Desktop\meshgrid.m

SO which clearly shows that u have a file named meshgrid.m placed at ur desktop..
Just to me a favor... change the name of this file to any anything.. or according to my suggestion change its name to mshfisher.m

and now run ur code... U will be happy to see ur lines working...

and yeah dont forget to say Thanks in case it works...!!! :o)))

Happy Playing MATLAB..!!
Faraz

Subject: Meshgrid error?

From: Carp Fisher

Date: 8 Mar, 2009 00:10:45

Message: 9 of 10

Thanks!

Subject: Meshgrid error?

From: Anyi Oks

Date: 11 Oct, 2010 11:29:05

Message: 10 of 10

Hi Faraz (and anyone else who may choose to help). I have the same problem. I get the response below whenever I run a meshgrid function.

??? Attempt to execute SCRIPT meshgrid as a function:
C:\Program Files\MATLAB\R2008b\toolbox\matlab\elmat\meshgrid.m

I think I know how it came to be though. One day I opened the meshgrid function to look at the source of my error, but I mistakenly saved another program I had written in its place. So, I think the meshgrid function was no longer a viable script at that point.
I wish I could re-download the original meshgrid script. I just need this fixed.

Any useful help will go a long way.

Thanks,
Anyi

"Faraz Afzal" <farazafzal@gmail.com> wrote in message <gov2pt$nnn$1@fred.mathworks.com>...
> Carp Fisher <bmjim@gmail.com> wrote in message <33231975.1236469388537.JavaMail.jakarta@nitrogen.mathforum.org>...
> > Sorry about that. When I run this:
> >
> > [X,Y] = meshgrid(1:3,10:14)
> >
> > I get this error:
> >
> > ??? Attempt to execute SCRIPT meshgrid as a function:
> > C:\Documents and Settings\Kim\Desktop\meshgrid.m
> >
> > Error in ==> meshgrid at 1
> > [X,Y] = meshgrid(1:3,10:14)
>
>
>
> Hello Carp Fisher.....
>
> here is yourmistake..
> when u execute u pop up with this error
>
> ??? Attempt to execute SCRIPT meshgrid as a function:
> C:\Documents and Settings\Kim\Desktop\meshgrid.m
>
> SO which clearly shows that u have a file named meshgrid.m placed at ur desktop..
> Just to me a favor... change the name of this file to any anything.. or according to my suggestion change its name to mshfisher.m
>
> and now run ur code... U will be happy to see ur lines working...
>
> and yeah dont forget to say Thanks in case it works...!!! :o)))
>
> Happy Playing MATLAB..!!
> Faraz

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