Hi, all. This is a real newbie question involving amend }. I have an
arbitrary matrix MAT = 2 3 4 $ i.100. 

  mat

 0  1  2  3

 4  5  6  7

 8  9 10 11

 

12 13 14 15

16 17 18 19

20 21 22 23

 

I want to substitute the first row of each plane with new lists. I extract
the original lists and multiple them by 100 by 0{"2 mat

 

   100* 0{"2 mat

   0  100  200  300

1200 1300 1400 1500   

 

Now comes the surprise. I can't reverse the process of amending the original
matrix with amend }

   

(100* 0{"2 mat) 0}"2 mat

|rank error

|   (100*0{"2 mat)    0}"2 mat

   

I can do this with explicit indexing

 

(100* 0{"2 mat) (<0 1; 0; 0 1 2 3) } mat

   0  100  200  300

   4    5    6    7

   8    9   10   11

 

1200 1300 1400 1500

  16   17   18   19

  20   21   22   23

 

But when I tried using a: to index all planes and columns, I get a length
error

   

(100* 0{"2 mat) (<a:; 0; a:) } mat

|length error

 

I tried parentheses and the like but still got the error. I suspect this one
is simple syntax but the first one puzzles me.

 

Any wisdom on this would be much appreciated. 

 

Bob

 

 

 

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to