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:
Undefined function or method...for input arguments of type 'char'

Subject: Undefined function or method...for input arguments of type 'char'

From: hg Georges

Date: 23 Mar, 2008 10:15:04

Message: 1 of 7

Hi!
I have a problem:when trying to use 'imread' or
'uigetfile',I get the message
"Undefined function or method 'syms' for input
arguments of type 'char'".
It began when trying to execute a .m file in from the 'work'
 subdirectory, but strangely this happened after a long time
while everything was going OK.
Now it happens whenever the .m file is located.
Seemingly, this happens with many functions and methods, (as
one can see when searching "matlab 2007a "undefined
function"" on Google).
I think this should be due to a problem with the path (I
think forcing Matlab to write in "C:\My documents\Matlab"
was a very bad idea).
Does anybody know how to fix this problem in a general way?

Subject: Undefined function or method...for input arguments of type 'char'

From: Dani Zigon

Date: 1 Jul, 2008 15:24:02

Message: 2 of 7

type in Matlab main window
which uigetfile

if nothing comes up or it says that uigetfile cannot be
found, there is something wrong with your path. The easiest
two fixes are
1. change your directory to the correct one
or
2. simply rename the file-- just do a 'save as' and then for
instance NEW or something.

retype in the which + name of .m file command like you did above
It should show the path. If it does, the problem has been fixed

Dani

"hg Georges" <harry.georgess@gmail.com> wrote in message
<fs5aj8$mn1$1@fred.mathworks.com>...
> Hi!
> I have a problem:when trying to use 'imread' or
> 'uigetfile',I get the message
> "Undefined function or method 'syms' for input
> arguments of type 'char'".
> It began when trying to execute a .m file in from the 'work'
> subdirectory, but strangely this happened after a long time
> while everything was going OK.
> Now it happens whenever the .m file is located.
> Seemingly, this happens with many functions and methods, (as
> one can see when searching "matlab 2007a "undefined
> function"" on Google).
> I think this should be due to a problem with the path (I
> think forcing Matlab to write in "C:\My documents\Matlab"
> was a very bad idea).
> Does anybody know how to fix this problem in a general way?

Subject: Undefined function or method...for input arguments of type 'char'

From: Iris Müller Iris Müller

Date: 28 Feb, 2013 18:19:10

Message: 3 of 7

"Dani Zigon" <danimal429@yahoo.com> wrote in message <g4di6i$att$1@fred.mathworks.com>...
> type in Matlab main window
> which uigetfile
>
> if nothing comes up or it says that uigetfile cannot be
> found, there is something wrong with your path. The easiest
> two fixes are
> 1. change your directory to the correct one
> or
> 2. simply rename the file-- just do a 'save as' and then for
> instance NEW or something.
>
> retype in the which + name of .m file command like you did above
> It should show the path. If it does, the problem has been fixed
>
> Dani
>
> "hg Georges" <harry.georgess@gmail.com> wrote in message
> <fs5aj8$mn1$1@fred.mathworks.com>...
> > Hi!
> > I have a problem:when trying to use 'imread' or
> > 'uigetfile',I get the message
> > "Undefined function or method 'syms' for input
> > arguments of type 'char'".
> > It began when trying to execute a .m file in from the 'work'
> > subdirectory, but strangely this happened after a long time
> > while everything was going OK.
> > Now it happens whenever the .m file is located.
> > Seemingly, this happens with many functions and methods, (as
> > one can see when searching "matlab 2007a "undefined
> > function"" on Google).
> > I think this should be due to a problem with the path (I
> > think forcing Matlab to write in "C:\My documents\Matlab"
> > was a very bad idea).
> > Does anybody know how to fix this problem in a general way?
>


Hi!

I have the same problem. I did what you said.The pathway is correct, and I renamed the file. When I type which XXX.m the file can be found. but when I try to open it it says again "undefined function......"
Is there another possiblity what could be wrong. I´m very new in MAtlab, so maybe it is something very basic??

Thank you!

Subject: Undefined function or method...for input arguments of type 'char'

From: varunsanduja@gmail.com

Date: 30 Jun, 2013 18:07:04

Message: 4 of 7

Hello
i m facing the same problem. when m gng to run the code then got dis msg in command window (??? Undefined function or method 'histogram' for input arguments of type 'char'.) What should i do???
 

Subject: Undefined function or method...for input arguments of type 'char'

From: Steven_Lord

Date: 1 Jul, 2013 14:18:36

Message: 5 of 7



<varunsanduja@gmail.com> wrote in message
news:2efa8648-6a24-44b3-95b8-00d891f87cef@googlegroups.com...
> Hello
> i m facing the same problem. when m gng to run the code then got dis msg
> in command window (??? Undefined function or method 'histogram' for input
> arguments of type 'char'.) What should i do???

There's no function named histogram in MATLAB or any of the toolboxes. Did
you mean to call HIST instead?

http://www.mathworks.com/help/matlab/ref/hist.html

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: Undefined function or method...for input arguments of type 'char'

From: James

Date: 30 Oct, 2013 16:47:06

Message: 6 of 7

"Steven_Lord" <slord@mathworks.com> wrote in message <kqs33s$c1l$1@newscl01ah.mathworks.com>...
>
>
> <varunsanduja@gmail.com> wrote in message
> news:2efa8648-6a24-44b3-95b8-00d891f87cef@googlegroups.com...
> > Hello
> > i m facing the same problem. when m gng to run the code then got dis msg
> > in command window (??? Undefined function or method 'histogram' for input
> > arguments of type 'char'.) What should i do???
>
> There's no function named histogram in MATLAB or any of the toolboxes. Did
> you mean to call HIST instead?
>
> http://www.mathworks.com/help/matlab/ref/hist.html
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

It means that you're not in the right folder, i.e. the folder that the .m file is in. It, like all of Matlabs Byzantine error messages, is convoluted. I've been programming in matlab on and off for 2 years now and still find that there error messages are like reading hieroglyphics. Perhaps there will be a watershed moment where I start to understand what they mean, but until that day, I will be grumpy about it. Regardless, here's how you fix: just look at the current folder section of Matlab's gui window, find the folder where the .m file you need to use is and double click that folder. There, now you're in the right folder.

Subject: Undefined function or method...for input arguments of type 'char'

From: Steven Lord

Date: 30 Oct, 2013 17:40:41

Message: 7 of 7


"James " <jkeary@gmail.com> wrote in message
news:l4rd6a$h66$1@newscl01ah.mathworks.com...
> "Steven_Lord" <slord@mathworks.com> wrote in message
> <kqs33s$c1l$1@newscl01ah.mathworks.com>...
>>
>>
>> <varunsanduja@gmail.com> wrote in message
>> news:2efa8648-6a24-44b3-95b8-00d891f87cef@googlegroups.com...
>> > Hello
>> > i m facing the same problem. when m gng to run the code then got dis
>> > msg in command window (??? Undefined function or method 'histogram'
>> > for input arguments of type 'char'.) What should i do???
>>
>> There's no function named histogram in MATLAB or any of the toolboxes.
>> Did you mean to call HIST instead?
>>
>> http://www.mathworks.com/help/matlab/ref/hist.html
>>
>> --
>> Steve Lord
>> slord@mathworks.com
>> To contact Technical Support use the Contact Us link on
>> http://www.mathworks.com
>
> It means that you're not in the right folder, i.e. the folder that the .m
> file is in.

That's one possible meaning. It could also mean that you mistyped the file
name, or that you are trying to use a function from a toolbox that you don't
have installed, or that you are trying to use a function that's only defined
for certain types of variables on a different type of variable (for
instance, using something that's only defined for symbolic variables on
numeric variables.)

> It, like all of Matlabs Byzantine error messages, is convoluted.

Some of the error messages could be improved, and some are very detailed or
specific. But convoluted? I've seen much, much, MUCH worse in other
languages (like using some templatized class from the Standard Template
Library incorrectly in C++ -- I've seen the HTML source for web pages and
some page-long XML files that used fewer greater-than and less-than signs
than the six or seven lines of errors that were thrown in one or two of
those cases.)

> I've been programming in matlab on and off for 2 years now and still find
> that there error messages are like reading hieroglyphics. Perhaps there
> will be a watershed moment where I start to understand what they mean, but
> until that day, I will be grumpy about it.

If there are specific messages that you feel don't give you enough
information about the source of the problem, or that you have a suggestion
for how to improve, please send your suggestions to Technical Support so
that they can report them to the development staff.

> Regardless, here's how you fix: just look at the current folder section of
> Matlab's gui window, find the folder where the .m file you need to use is
> and double click that folder. There, now you're in the right folder.

That's one possible solution that would resolve one of the possible causes
of that error. You could also change your call to call the correct function
(as I suggested, I believe they wanted to call HIST) as a solution to a
different possible cause, which I believe is the more common cause of this
error.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

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