Anssi Seppälä wrote:
> Reading numeric data from Excel the decimal separator is here comma " ,
> ". Since in J the text-to-num-conversion function ". does not
> understand comma as decimal separator I must change the commas in the
> boxed matrix DATA to dots. I could write a short function:
>
> rplccomma=: 3 : '''.'' (I. y. e. '','')} y.'
>
> and then run
>
> NUM= . ". each rplccomma each DATA.
>
> For large DATA this takes long time to run. Ideas to make this
> conversion faster are wellcome. Thanks.
For long boxed lists, it is often quicker to work on the razed list. For
example:
brc=: 3 : 0
y=. ; y. ,each {:a.
($y.) $ < ;._2 '.' (I. y e. ',') } y
)
A=: 10000 $ '123,45';'1234,56'
(brc A) -: rplccomma each A
1
timex 'brc A'
0.026006
timex 'rplccomma each A'
0.141489
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm