"Rafa " <email@example.com> wrote in message news:firstname.lastname@example.org... > 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.)
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: