You can use grid to edit multi-dimensional arrays too
(('CELLEDIT';1),:'AXISNAMES';<;:'first second third fourth') grid i. 3 4 5 2
The display of the data is alterable by dragging and dropping axis labels (you
can drag them to the top of the grid too so you can show the desired slice.).
Note that altering the display of the grid doesn't change the shape of CELLDATA.
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:programming-
> [EMAIL PROTECTED] On Behalf Of Sherlock, Ric
> Sent: Monday, 2 June 2008 3:24
> To: Programming forum
> Subject: RE: [Jprogramming] Using grid for user input
>
> ---June Kim wrote:
> > Could anyone give me the definition of the verb that first displays
> > the contents of y, and after user modifies it and closes the grid
> > window, that returns the new values?
>
> I don't think that there is a ready-made verb that does that, but I
> agree it would be a great idea.
>
> For now here's a clunky method that uses the grid verb that already
> exists.
>
> load 'grid'
> (,:'CELLEDIT';1) grid i.4 5 NB. Creates an editable grid
>
> Edit the grid as desired but BEFORE you close it you can pull the data
> out by accessing CELLDATA in the numeric locale containing the grid.
> I'm sure there are clever ways of doing that but if you use ...
>
> conames 1 NB. returns only numeric locales
> 0 24 25
>
> ...then the last number is probably the one containing the grid.
> You can check its path if you like:
> copath '25'
> +------+----+-+
> |jzgrid|jgl2|z|
> +------+----+-+
>
> ]newdata=: CELLDATA_25_
> 52 1 2 3 4
> 5 6 7 8 9
> 10 11 144 13 14
> 15 16 17 18 19
>
> Now you can close your grid.
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm