a = []
for (var key in xkeys) {
a.push(x[key])
}
or, possibly,
a = []
for (var key in xkeys) {
a.push([key, x[key]])
}
On Sun, Aug 30, 2015 at 7:54 PM, Eric Martz <[email protected]>
wrote:
> $ load =1al4
> ANTIBIOTIC 11-JUN-97 1AL4
> GRAMICIDIN D FROM BACILLUS BREVIS (N-PROPANOL SOLVATE)
> found biomolecule 1: A, B
>
> $ x = {altloc!=''}.altloc.all.pivot
> $ print x
> {
> "A" : 238
> "B" : 244
> "C" : 34
> "D" : 12
> }
>
> The keys in the associative array x are easily extracted into an indexed
> array:
>
> $ xkeys = x.keys
> $ print xkeys.type
> array
> $ print xkeys
> A
> B
> C
> D
>
> Is there an easy way to put the values into an indexed array, something
> like x.values?
>
> If not, can someone show me how to write a 'for' loop to do that? (As
> explained in my previous message, I haven't discerned how to obtain the
> value for the Nth key when I don't know the key).
>
> Thanks, Eric
>
>
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Jmol-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jmol-users
>
>
--
Robert M. Hanson
Larson-Anderson Professor of Chemistry
Chair, Department of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr
If nature does not answer first what we want,
it is better to take what answer we get.
-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
------------------------------------------------------------------------------
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users