trouble with matrices in hoc

Anything that doesn't fit elsewhere.
Post Reply
etano

trouble with matrices in hoc

Post by etano »

Is it possible to connect matrix elements as one would with vector elements:

This is what I have:

Code: Select all

a.x[0][0] {
  pt3dclear()
  pt3dadd(4.75,-37.75,-9.75,3.75)
  pt3dadd(2.5,-39.25,-9.75,1.75)
...
}

a.x[0][1] {
  pt3dclear()
  pt3dadd(-18.5,-53.75,-19.5,1.5)
  pt3dadd(-21,-55.25,-21.75,1.75)
...
}

a.x[0][2] {
  pt3dclear()
  pt3dadd(-35.25,-78.25,-71.25,1.75)
  pt3dadd(-35.25,-78,-73.25,0.75)
...
}

a.x[0][3] {
  pt3dclear()
  pt3dadd(-35.25,-78.25,-71.25,1.75)
  pt3dadd(-36,-79.5,-72.5,1)
...
}
a.x[0][1] connect a.x[0][2](0),1
a.x[0][1] connect a.x[0][3](0),1
And I get the error

Code: Select all

oc>nrniv: x :not right number of subscripts
 in cells/j7edit.hoc near line 94
 a.x[0][1] connect a.x[0][2](0),1
Please help.
ted
Site Admin
Posts: 6384
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Post by ted »

What is the declaration of a?
etano

Post by etano »

Code: Select all

a = new Matrix(ndend,maxsubdend)
should I use:

Code: Select all

double a[ndend][maxsubdend]
instead?
ted
Site Admin
Posts: 6384
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Post by ted »

That's what I thought you did, but I was puzzled by the fact that your pt3d statements didn't
produce an error message. Probably some code executed earlier generates a default
section.
should I use:
Code:
double a[ndend][maxsubdend]
instead?
No. Neither a Matrix nor an array of doubles has anything to do with sections--they're just
collections of numbers.
Do this instead:

Code: Select all

create a[ndend][maxsubdend]
etano

Post by etano »

Alright thanks. That worked.
Post Reply