def b10_convertFrom(anum10, aradix, *args):
i = <NUM_LIT:0>;<EOL>k = <NUM_LIT:0>;<EOL>while (pow(aradix, i)) <= anum10:<EOL><INDENT>i = i + <NUM_LIT:1>;<EOL><DEDENT>forcelength = i<EOL>if len(args): forcelength = args[<NUM_LIT:0>]<EOL>if(forcelength and (forcelength < i)):<EOL><INDENT>error_exit('<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL><NUM_LIT:1>)<EOL><DEDENT>numm = anum10;<EOL>num_r = zeros((forcelength));<EOL>if(i):<EOL><INDENT>k = forcelength - i;<EOL><DEDENT>else:<EOL><INDENT>k = forcelength - <NUM_LIT:1>;<EOL><DEDENT>if(anum10 == <NUM_LIT:1>):<EOL><INDENT>num_r[(k)] = <NUM_LIT:1>;<EOL>return num_r;<EOL><DEDENT>for j in arange(i, <NUM_LIT:0>, -<NUM_LIT:1>):<EOL><INDENT>num_r[(k)] = fix(numm / pow(aradix, (j - <NUM_LIT:1>)));<EOL>numm = numm % pow(aradix, (j - <NUM_LIT:1>));<EOL>k = k + <NUM_LIT:1>;<EOL><DEDENT>return num_r<EOL>
ARGS
anum10            in      number in base 10
aradix            in      convert <anum10> to number in base
                          + <aradix>

OPTIONAL
forcelength       in      if nonzero, indicates the length
                          + of the return array. Useful if
                          + array needs to be zero padded.

DESC
Converts a scalar from base 10 to base radix. Return
an array.

NOTE:
"Translated" from a MatLAB script of the same name.