×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Are you an
Engineering professional?
Join Eng-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# MathCAD 15 - strip variable's units?

## MathCAD 15 - strip variable's units?

(OP)
I've run into various situations where it would be useful to just simply strip the units off of a variable, so you are only left with the scalar value.

...or even just using a function to check the units of a variable that is already defined.

I've never been able to find anything, but is there a built-in function or a convention for stripping away the units?

### RE: MathCAD 15 - strip variable's units?

Could you define a Pscalar quantity after P and manually strip the units off.

P := 100lbf
Pscalar := P/lbf

...but I can't recall if I have ever solved that problem yet.

### RE: MathCAD 15 - strip variable's units?

(OP)
I'd like to come up with a more generic function that can work with any variable and any unit...

I just don't know if it's possible...

#### CODE --> Pseudocode

TruncU (P) := what units does variable "P" have?
If units = lbf
Then TruncU (P) = P / lbf
If units = psi
Then TruncU (P) = P / psi
... 

### RE: MathCAD 15 - strip variable's units?

When I need a variable to be unitless, I've always found it easier to just divide out the units when I make the equation:

You have to track it on your own, but you'd be doing that anyway with your unit stripping function.

### RE: MathCAD 15 - strip variable's units?

There was a function called UnitsOf(your variable) that would strip the units, but it strips off the base units, i.e., SI or US base units, not the derived.

TTFN (ta ta for now)
I can do absolutely anything. I'm an expert! https://www.youtube.com/watch?v=BKorP55Aqvg
FAQ731-376: Eng-Tips.com Forum Policies forum1529: Translation Assistance for Engineers Entire Forum list http://www.eng-tips.com/forumlist.cfm

### RE: MathCAD 15 - strip variable's units?

The only safe way to "strip units" is to divide by the units manually.

As IRstuff says, you can use the "UnitsOf" function, but it divides by the base units. How would a fully automated solution that strips the units of any / all variables know whether you wanted the scalar answer for a 10 kilogram mass (say) to be given as 0.01 (tonnes), 10 (kg), 10000 (g), 22.046 (pounds) or 352.74 (ounces)?

### RE: MathCAD 15 - strip variable's units?

(OP)
Wow. I never knew "UnitsOf" was an actual function that existed. It's not exactly what I was hoping for, but it's at least a step in the right direction. Might be able to fudge a useful custom function with it. Neat!

### RE: MathCAD 15 - strip variable's units?

P:=2500*lbf

P/UnitsOf(P)returns 1.112 X 10^4 regardless of which Unit System is chosen. Seems to be identical with the SIUnitsOf function.

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

#### Resources

Low-Volume Rapid Injection Molding With 3D Printed Molds
Learn methods and guidelines for using stereolithography (SLA) 3D printed molds in the injection molding process to lower costs and lead time. Discover how this hybrid manufacturing process enables on-demand mold fabrication to quickly produce small batches of thermoplastic parts. Download Now
Examine how the principles of DfAM upend many of the long-standing rules around manufacturability - allowing engineers and designers to place a partâ€™s function at the center of their design considerations. Download Now
Taking Control of Engineering Documents
This ebook covers tips for creating and managing workflows, security best practices and protection of intellectual property, Cloud vs. on-premise software solutions, CAD file management, compliance, and more. Download Now

Close Box

# Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!