Page 1 of 1

how to convert from a character vector to a number?

Posted: Mon Nov 06, 2017 4:47 pm
by AntonioDiNarzo
e.g., say I have:

Code: Select all

     ]display '12' '2.7' '721324'
┌→────────────────────┐
│ ┌→─┐ ┌→──┐ ┌→─────┐ │
│ │12│ │2.7│ │721324│ │
│ └──┘ └───┘ └──────┘ │
└∊────────────────────┘

how do I get to:

Code: Select all

     
     ]display 12 2.7 721324
┌→────────────┐
│12 2.7 721324│
└~────────────┘

Re: how to convert from a character vector to a number?

Posted: Mon Nov 06, 2017 6:32 pm
by paulmansour
See the primitive "execute" : ⍎

And also see the system function ⎕VFI

For a vector of vectors as you show, you will need to use these functions with the each operator: ¨

Alternatively you can laminate the data together in a single, blank delimited string and avoid the each operator.