Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Undefined function or variable - for no reason...
Replies: 27   Last Post: Jan 28, 2014 9:41 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Steven Lord

Posts: 898
Registered: 9/26/13
Re: Undefined function or variable - for no reason...
Posted: Nov 12, 2013 3:49 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply


"Rafa " <rafael.ballesterripoll@uzh.ch> wrote in message
news:l5tln8$s74$1@newscl01ah.mathworks.com...
> Hi all,
> I'm having the same problem here. In my case, functions don't run when
> they are part of a class folder (i.e. starting with '@'). So I have the
> strange behaviour:
>

>>> which -all ttm
> /home/rafa/tensor_toolbox/@ttensor/ttm.m % ttensor method
> /home/rafa/tensor_toolbox/@tensor/ttm.m % tensor method
> /home/rafa/tensor_toolbox/@sptensor/ttm.m % sptensor method
> /home/rafa/tensor_toolbox/@ktensor/ttm.m % ktensor method

>>> ttm
> Undefined function or variable 'ttm'.
>
> ('ttm' is a perfectly valid file from a widely-used toolbox, it used to
> work until it randomly broke, and the '/home/rafa/tensor_toolbox/' folder
> belongs to the path, as it should be)
>
> In general, a lot of confusion seems to exist around these 'undefined'
> error issues. Anyone has any clue?


Note that all four of those function paths have a comment "<something>
method" at the end? That means they are class methods and you MUST call them
with an instance of that class for at least one of the inputs (unless
they're Static methods, in which case you need to call them using the name
of the class.)

http://www.mathworks.com/help/matlab/matlab_oop/specifying-methods-and-functions.html

If those methods are NOT Static, you would need to call them with at least
one ttensor object as input (in which case the first method is called), a
tensor object as input (second method), a sptensor object (third), or a
ktensor (fourth.) Your call with 0 inputs doesn't give ANY of those objects
as input, so MATLAB doesn't know which method to call and so doesn't call
any of them. Since there's no non-method function named ttm visible to
MATLAB (it would have shown up in the WHICH output if there were) it
correctly says essentially "I don't know what you want me to do."

If they were Static and accepted 0 inputs, you would call them as:

ttensor.ttm()
tensor.ttm()
sptensor.ttm()
ktensor.ttm()

The help for those methods should indicate the correct way to call them.

help ttensor.ttm

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



Date Subject Author
6/11/10
Read Undefined function or variable - for no reason...
Theophane
6/11/10
Read Re: Undefined function or variable - for no reason...
Steven Lord
8/10/10
Read Re: Undefined function or variable - for no reason...
teki
8/10/10
Read Re: Undefined function or variable - for no reason...
Shanmugam Kannappan
8/10/10
Read Re: Undefined function or variable - for no reason...
teki
8/10/10
Read Re: Undefined function or variable - for no reason...
Jan Simon
8/10/10
Read Re: Undefined function or variable - for no reason...
teki
8/10/10
Read Re: Undefined function or variable - for no reason...
Jan Simon
8/10/10
Read Re: Undefined function or variable - for no reason...
teki
9/17/10
Read Re: Undefined function or variable - for no reason...
Øyvind
9/22/10
Read Re: Undefined function or variable - for no reason...
Jeremy Lagorse
9/23/10
Read Re: Undefined function or variable - for no reason...
Øyvind
4/7/11
Read Re: Undefined function or variable - for no reason...
Shai
6/28/11
Read Re: Undefined function or variable - for no reason...
nick
3/23/12
Read Re: Undefined function or variable - for no reason...
Hye Young
8/10/10
Read Re: Undefined function or variable - for no reason...
us
8/10/10
Read Re: Undefined function or variable - for no reason...
Walter Roberson
11/12/13
Read Re: Undefined function or variable - for no reason...
Rafa
11/12/13
Read Re: Undefined function or variable - for no reason...
Steven Lord
5/30/12
Read Re: Undefined function or variable - for no reason...
Di
5/30/12
Read Re: Undefined function or variable - for no reason...
Øyvind
5/30/12
Read Re: Undefined function or variable - for no reason...
John D'Errico
5/30/12
Read Re: Undefined function or variable - for no reason...
Øyvind
5/30/12
Read Re: Undefined function or variable - for no reason...
John D'Errico
5/30/12
Read Re: Undefined function or variable - for no reason...
Frank
1/27/14
Read Re: Undefined function or variable - for no reason...
Yilin
1/28/14
Read Re: Undefined function or variable - for no reason...
Steven Lord
1/28/14
Read Re: Undefined function or variable - for no reason...
Yilin

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.