Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Is there a function which applied to a quantity returns its numerical value so I for instance can fill it into my Predictorfunction?

share|improve this question

1 Answer 1

Oops - found it! QuantityMagnitude[quantity] does the job. For example,

In[1]:= QuantityMagnitude[Quantity[1, "Feet"]]

Out[1]= 1
share|improve this answer
2  
If you want to remove the units in an expression regardless of what level that unit resides on, you can tack /. Quantity :> Composition[QuantityMagnitude, Quantity] (/. Quantity :> QuantityMagnitude@*Quantity in version 10) or /. Quantity[x_, y_] :> x to the end of your expression. Examples. –  seismatica Aug 4 at 18:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.