%:2
1.41421
   
   A=:i.1 4 1 4 2 1
   f=: 13 :'i.(1~:$y)#$y'
   
   ]B=:f A
 0  1
 2  3
 4  5
 6  7

 8  9
10 11
12 13
14 15

16 17
18 19
20 21
22 23

24 25
26 27
28 29
30 31

   f
[: i. $ #~ 1 ~: $

Linda

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of 'Pascal
Jasmin' via Programming
Sent: Friday, July 18, 2014 12:26 AM
To: [email protected]
Subject: Re: [Jprogramming] Discarding unneeded dimensions

the common way is {. i. 1 3 5

   $ {. i. 1 3 5 
3 5 

a trick to remove all 1s

   $ (, $~ 1 -.~ $) i. 1 3 1 5 
3 5 



----- Original Message -----
From: Jon Hough <[email protected]>
To: [email protected]
Cc: 
Sent: Friday, July 18, 2014 12:12:40 AM
Subject: [Jprogramming] Discarding unneeded dimensions

If I have an array of shape 1 3 6, for example, but I want to discard the 1,
to give shape 3 6, what is the best way to do so?
I found that doing ,/  on the array works. 
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

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

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

Reply via email to