Neuron and Matlab binary communication, IPC
Posted: 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
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