Re: From PaddedForm to numbers?
- To: mathgroup at smc.vnet.net
- Subject: [mg80499] Re: From PaddedForm to numbers?
- From: David Bailey <dave at Remove_Thisdbailey.co.uk>
- Date: Thu, 23 Aug 2007 06:23:05 -0400 (EDT)
- References: <faj6fp$9gt$1@smc.vnet.net>
Curtis Osterhoudt wrote: > Hi, all, > > Given a number in PaddedForm, how can I easily convert it to a number which > can be worked with? This would be the analogue of ToExpression[ > some_string_representing_a_number ]. > > Thanks! > > PaddedForm is a wrapper - like MatrixForm, and many others. WRI have a standard comment in relation to these - "PaddedForm acts as a ?wrapper?, which affects printing, but not evaluation." The wording of this has always seemed to me unfortunate, because if you leave wrapper round an object it looks OK, but can't be incorporated in a further calculation - in other words a wrapper certainly does affect evaluation! The ideal solution to your problem is to use PaddedForm inside a Print statement so that it does not remain part of a stored expression. I assume you have an expression such as: xx=PaddedForm[22,4]; This sets xx to a PaddedForm structure - as can be observed by looking at xx in FullForm: FullForm[xx] If you really need to re-activate PaddedForm structures - rather than just avoid them, you could use: yy /. PaddedForm[x_,_]->x where yy can be any expression involving zero or more PaddedForm constructs. David Bailey http://www.dbaileyconsultancy.co.uk
- Follow-Ups:
- Re: Re: From PaddedForm to numbers?
- From: Curtis Osterhoudt <cfo@lanl.gov>
- Re: Re: From PaddedForm to numbers?