[Thread Prev][Thread Next][Index]

Re: [ferret_users] Separate a 2-digits integer into 2 1-digit integers



Hi,

let A_ij_2 = mod(A_ij,10)     ! Get last digit
let A_ij_1 = (A_ij-A_ij_2)/10  ! Remove last digit and divide

alternatively,

let  A_ij_1 = int(A_ij/10)       ! Divide and truncate to get leading digit

See

show fun mod
show fun int

Russ

On 09/09/14 03:53, Ge Peng - NOAA Affiliate wrote:

I need to separate an array of 2-digits integers into two separate arrays of 1-digit integers – one takes the value of the tenth and the other the one digit of the original integer values at each element of the array.


For example, if the value of A_ij is 23, then A_ij_1 will be 2 and A_ij_2 will be 3.


Any suggestion?


Thanks,


--- Peng


--
Ge Peng, Ph.D
Research Scholar
Cooperative Institute for Climate and Satellites NC
North Carolina State University
NOAA's National Climatic Data Center
151 Patton Ave, Asheville, NC 28801
ge.peng@xxxxxxxx
o: +1 828 257 3009
f:  +1 828 257 3002

Following CICS-NC on Facebook





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

Privacy Policy | Disclaimer | Accessibility Statement