Reputation: 4650
I'm working with a class like this:
class Select(object):
def __init__(self, interface):
...
def project(self, ID):
...
def __call__(self, datatype_or_path):
...
When I try to call this method (basically a functor) from Matlab like:
select = Select(blah);
select('blah');
I get the following error:
Array formation and parentheses-style indexing with objects of class
'py.pyxnat.core.select.Select' is not allowed. Use objects of class
'py.pyxnat.core.select.Select' only as scalars or use a cell array.
EDIT:
select.('__call__')('blah')
does not seem to work either
Upvotes: 1
Views: 353
Reputation: 4650
From Matlab Tech Support:
My name is sai and I am writing in reference to your Technical Support Case #01708094 regarding 'Calling python functors through matlab'.
I understand that you are experiencing issues while invoking a functor defined in python from MATLAB.
I see that you are using MATLAB R2014b. Please note that this is a known issue in MATLAB R2014b which has been fixed in MATLAB R2015a and there are no known work arounds for this issue in R2014b. If it is feasible, I would recommend to upgrade to MATLAB R2015a which will help you resolve this issue.
Upvotes: 1
Reputation: 77912
Obviously the Select
class you use in your code is a py.pyxnat.core.select.Select
, not your own Select
class. Check your imports (and specifically check for a 'star import' - from xxx import *
- after the line where you import your own Select
class.
Upvotes: 0