Author Topic: Hoe to declare arrays in EJS  (Read 8812 times)

Fred Chuit

  • Newbie
  • *
  • Posts: 18
Hoe to declare arrays in EJS
« on: December 24, 2008, 02:26:30 am »
Dear EJS-users,

I can not find info how to declare arrays on the variable page of EJS.
I would like to use single and multi dimension arrays of strings and arrays of double.
What do I have to fill in in the coloms: Name Value Type Dimension.

Already many thanks for your help.

Fu-Kwun Hwang

  • Administrator
  • Hero Member
  • *****
  • Posts: 3062
    • Enjoy the fun of physics with simulations
Re: Hoe to declare arrays in EJS
« Reply #1 on: December 24, 2008, 08:10:01 am »
In the last column for the variable type in [3],then you will have 1D array with 3 element.
Type in [3][5] then you will have 2D array.
Normally, I will define variables for # of elements,
e.g.: nx=3,ny=5, then type in [nx][ny]

If you check out simulations posted in this forum with many particles/elements,
you can download ejs source and find out how it was defined.