Declare a matrix in NMODL

NMODL and the Channel Builder.
Post Reply
Posts: 2
Joined: Tue May 12, 2009 10:01 am

Declare a matrix in NMODL

Post by redarrow »


I was wondering whether it is possible to declare a matrix in NMODL, without having to use VERBATIM blocks. I tried to use the same syntax as for arrays, but the compilation failed.

Thank you for your help,
Site Admin
Posts: 1607
Joined: Wed May 18, 2005 3:32 pm

Re: Declare a matrix in NMODL

Post by hines »

I'm afraid nmodl does not support multidimensional arrays. You have to map it into a fixed size 1-d array.
That is often unacceptable and so many mod files use VERBATIM to wrap hoc Vector using
extern int vector_capacity(Vect*);
extern void vector_resize(Vect*, int);
extern double* vector_vec(Vect*);
extern Vect* vector_arg(int);
extern bool is_vector_arg(int);
See nrn/src/nrnoc/pattern.mod or (simpler) nrn/share/examples/nrniv/netcon/vecevent.mod for examples.
Post Reply