I have not done this before.
The following way might work. (But I am not sure).
EJS use the variable name to find out the dimension for that variable (to draw those vectors).

So you need to dynamically re-define/re-assign the array.
e.g. bx=new double[nx][ny]; by=new double[nx][ny]
And assign values (with loop) to those two arrays.