Neuron and Matlab binary communication, IPC

Post Reply
JimH
Posts: 48
Joined: Tue Apr 10, 2007 3:36 pm
Location: Duke University

Neuron and Matlab binary communication, IPC

Post by JimH » Thu Jul 19, 2012 9:09 pm

Hi all,

I'm using MS Windows and I've manged to setup back and forth communication between NEURON and Matlab using stdin/stdout. I can use this communication method to pass small variables back and forth using the programs' interpreters to process new variables (i.e. something like my_var = 5). I was hoping to find an alternative for passing large vectors back and forth between the two that avoids character representations of numbers and thus delays associated with numeric parsing of strings.

Currently I am executing NEURON as a child process from Matlab. I am calling the executable neuron.exe with the -isatty option. My current approach for passing data is to use files and the Vector class' binary read/write functionality.

The real confusion I have is lack of knowledge about available IPC options in NEURON (I think). To a certain extent I could send data from Neuron to Matlab in binary if I knew how to print binary in NEURON i.e. write each double value as 8 byte characters. I could maybe perform the same thing in reverse although it is unclear how to go from a character string in NEURON and to typecast the string to a double array or Vector array. In Matlab this would be done using the typecast function. This of course is a bit of a hack and some easier method, if it exists, would be preferable.

Thoughts?

Jim

hines
Site Admin
Posts: 1494
Joined: Wed May 18, 2005 3:32 pm

Re: Neuron and Matlab binary communication, IPC

Post by hines » Mon Jul 23, 2012 10:21 am

I'm guessing that the Python interface is appropriate for binary exchange of data. Most of what I have seen, though, is Python calling Matlab instead of the
other way around. Anyway, you might get some clues from
http://code.google.com/p/danapeerlab/so ... tlabcom.py
and
http://mlabwrap.sourceforge.net/

http://stackoverflow.com/questions/1707 ... rom-matlab
seems to go in the right direction.

Post Reply