[Numpy-discussion] Python vector and matrix formatter similar to Matlab

Simon Wood sgwoodjr at gmail.com
Sat Mar 10 02:14:24 EST 2007


To all,
I came across an old thread in the archives in which Alexander Schmolck gave
an example of a Matlab like matrix formatter he authored for Python. Is this
formatter still available some where? Or has anyone else done anything
similar?

-Simon
P.S. Here is a short example of the output:


>>>* a
*array([[-9.90000000e+01,  -9.72817182e+01,   0.00000000e+00,  -7.99144631e+01],
       [-4.54018500e+01,   4.84131591e+01,   3.03428793e+02,   9.96633158e+02],
       [2.88095799e+03,   8.00308393e+03,   2.19264658e+04,   5.97741417e+04]])
>>>* m = matrix(a)
*>>>* m
*matrix('''
1.0E+04 *

  -0.00990   -0.00973    0.00000   -0.00799
  -0.00454    0.00484    0.03034    0.09966
   0.28810    0.80031    2.19265    5.97741
''')
>>>* m.show('long')
*matrix('''
1.0E+04 *


Columns 0 through 3

  -0.009900000000000   -0.009728171817154    0.000000000000000
  -0.004540184996686    0.004841315910258    0.030342879349274
   0.288095798704173    0.800308392757538    2.192646579480672

Columns 3 through 4

  -0.007991446307681
   0.099663315842846
   5.977414171519782
''')
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20070310/e412896a/attachment.html>


More information about the NumPy-Discussion mailing list