[nengo-user] error using nengo in matlab

Terry Stewart terry.stewart at gmail.com
Thu Dec 19 15:21:46 EST 2013


Hello, and thanks for the question!

What script are you running before doing
----
C=javaMethod('__tojava__',python.get('C'),java.lang.Class.forName('java.lang.Object'));
----
?

Before doing that, you should be running a script like this:

myscript.py:
-------
import nef

net = nef.Network('Example')

net.make_input('input A',[0])
net.make_input('input B',[0])

A = net.make('A',100,1)
B = net.make('B',100,1)
C = net.make('C',100,1)

net.connect('input A','A')
net.connect('input B','B')
net.connect('A','C')
net.connect('B','C')
net.add_to_nengo()
------------

in matlab:
----------
python.execfile('myscript.py')
--------


Notice that I've given the ensembles the variable names A, B, and C.
If I had have just done

---------
net.make('A',100,1)
net.make('B',100,1)
net.make('C',100,1)
---------

then it wouldn't work, because then there's no variables called A, B,
or C for matlab to find.


Does that help?

Terry

On Thu, Dec 19, 2013 at 8:47 AM, 王雪菲 <xuefeiwang1211 at gmail.com> wrote:
> hello everyone:
>     I'm reading documentation of nengo and trying to use it in matlab.But
> every time I run: "
> C=javaMethod('__tojava__',python.get('C'),java.lang.Class.forName('java.lang.Object'));",
>
> I got the following message:
> "??? Error using ==> javaMethod
> The second argument to javaMethod must be a Java object array or
> a character string specifying the class".
>
> Then I change the sentence to:
> "C=javaMethod('__tojava__',PyObject(python.get('C')),java.lang.Class.forName('java.lang.Object'));",
>
> It returned a null pointer error like:
> "??? Error using ==> javaMethod
> Java exception occurred:
> java.lang.NullPointerException
> at org.python.core.PyObject.proxyInit(PyObject.java:125)
> at org.python.core.PyObject.getJavaProxy(PyObject.java:299)
> at org.python.core.PyObject.__tojava__(PyObject.java:265)".
>
> It seems that python.get('C') only returns null,and can't get the
> information of ensemble C.
>
> I do this  on Windows7 and use matlabr2010b.
> How can I solve this problem?
> Thank you very much.
>
>
>
>
> _______________________________________________
> nengo-user mailing list
> nengo-user at ctnsrv.uwaterloo.ca
> http://ctnsrv.uwaterloo.ca/mailman/listinfo/nengo-user
>



More information about the nengo-user mailing list