Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

14,931 views
Skip to first unread message

hg Georges

unread,
Mar 23, 2008, 6:15:04 AM3/23/08
to
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?

Dani Zigon

unread,
Jul 1, 2008, 11:24:02 AM7/1/08
to
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.g...@gmail.com> wrote in message
<fs5aj8$mn1$1...@fred.mathworks.com>...

Iris Müller Iris Müller

unread,
Feb 28, 2013, 1:19:10 PM2/28/13
to
"Dani Zigon" <danim...@yahoo.com> wrote in message <g4di6i$att$1...@fred.mathworks.com>...
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!

varuns...@gmail.com

unread,
Jun 30, 2013, 2:07:04 PM6/30/13
to
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???

Steven_Lord

unread,
Jul 1, 2013, 10:18:36 AM7/1/13
to


<varuns...@gmail.com> wrote in message
news:2efa8648-6a24-44b3...@googlegroups.com...
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
sl...@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

James

unread,
Oct 30, 2013, 12:47:06 PM10/30/13
to
"Steven_Lord" <sl...@mathworks.com> wrote in message <kqs33s$c1l$1...@newscl01ah.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.

Steven Lord

unread,
Oct 30, 2013, 1:40:41 PM10/30/13
to

"James " <jke...@gmail.com> wrote in message
news:l4rd6a$h66$1...@newscl01ah.mathworks.com...
> "Steven_Lord" <sl...@mathworks.com> wrote in message
> <kqs33s$c1l$1...@newscl01ah.mathworks.com>...
>>
>>
>> <varuns...@gmail.com> wrote in message
>> news:2efa8648-6a24-44b3...@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
>> sl...@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.

szakac...@gmail.com

unread,
Jan 21, 2015, 3:03:52 PM1/21/15
to
Hi, Could you solve your probelm? If yes, can you show me how? Thanks

alva...@gmail.com

unread,
Dec 3, 2015, 4:12:26 PM12/3/15
to
Hello! Thanks everybody for the help. I just had that problem, and in my case it happened with a function I created myself, that was working perfectly and simply in one particular instance gave me this error consistently. But thanks to your suggestions I SOLVED IT! :) What I did: I renamed all involved functions, I removed all spaces from the names of all the folders and subfolders where the functions were, and updated the path. Then, it worked perfectly.

I am not very expert in programming but I do have been working with Matlab for years. And I think that this type of error speaks very poorly of Matlab, being a software product for which they charge such an exaggerated amount of money, however Steven Lord likes it or not.

Thanks again to everybody for the suggestions! I hope this helps.
0 new messages