how to convert from a character vector to a number?

Learning APL or new to Dyalog? Ask "silly" questions here, without fear...

how to convert from a character vector to a number?

Postby AntonioDiNarzo on Mon Nov 06, 2017 4:47 pm

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│
└~────────────┘
AntonioDiNarzo
 
Posts: 6
Joined: Mon Oct 23, 2017 3:14 pm

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

Postby paulmansour on Mon Nov 06, 2017 6:32 pm

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.
paulmansour
 
Posts: 420
Joined: Fri Oct 03, 2008 4:14 pm


Return to New to Dyalog?

Who is online

Users browsing this forum: No registered users and 1 guest