[Thread Prev][Thread Next][Index]

Re: [ferret_users] records



Hi Marco,

>     let A.x = "some name"
>     let A.y = 10
>     let A.z = 3.14
>
> Ultimately I'd like to define an array consisting of records:
>
>     let B.x = {"first name", "second name", "third name"}
>     let B.y = {1, 2, 3}
>     let B.z = {0.1, 0.2, 0.3}
>
> or the other way around starting with records and putting them in an
> array:
>
>     let C = { A, A2, ... }

This is far from ideal, but you can simulate a record with an array
and therefore an array of records with a two dimensional array:

let C0 = {"first", "second", "third", "1", "2", "3", "0.1", "0.2", "0.3"}
. . . .
let C = reshape(C0, . . . )  ! convert to 2D array
list C[j=1]
. . .

It seems that Ferret doesn't allow mixed types in single arrays, but
you can represent any numerical values with character strings as above
and "convert" them to numbers using the backquote evaluation:

let a = "0.1"
let b = `a` + 0.2
say `b`

Having said that, I think it would be more fruitful and rewarding to
use a scripting language like Ruby and Python to write such a program
as this, calling Ferret from within it, than to fight with Ferret.

Regards,

Ryo


[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement