Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

** Community Tip** - Learn all about the Community Ranking System, a fun gamification element of the PTC Community.
X

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Nov 18, 2017
09:42 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 18, 2017
09:42 PM

ReadExcel problem

The READEXCEL command on mathcad prime 4.0 will not transfer over my units in excel. How do I make it read my units or how can I add units?

10 REPLIES 10

Nov 18, 2017
10:01 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 18, 2017
10:01 PM

Excel has no units awareness, so you can't 'read' them in. You can, however, in mathcad multiply whatever you read in by a unit and it will then have that unit attached. If you are reading in a few values that's easy. If it's a matrix, then multiply each column or row by the unit.

Same thing writing out to excel - it won't let you send a unit. So you have to divide everything by the unit you want to get the right numerical value.

Remember - you might be displaying inches or millimeters or whatever - but to mathcad it is stored as the SI unit and only showing you what you ask for. So, you always have to work appropriately with units. Temperatures and angle degrees can be particularly tricky.

Now, if you had A1 = 5 and B1 = m in Excel, there might be a way to get mathcad to recognize that B1 is a unit and that A1*B1 = 5m. But I doubt it.

Nov 19, 2017
03:43 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 19, 2017
03:43 AM

Here's an example of the effort requred to get units (from an additional excel column) over to Mathcad:

As you can see, most of the work is in the GetUnit() function, and it will be a lot of if-statements if you want to be prepared for all possible units...

Success!

Luc

Nov 19, 2017
04:17 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 19, 2017
04:17 AM

Additionally to what Luc had written, you have to be aware that a routine like his GetUnit will only work OK with units of the very same dimension - in case of his exemple units of lengths. A Mathcad function unfortunately is not able to return values of different dimensions depending on an input argument.

Nov 19, 2017
06:12 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 19, 2017
06:12 AM

That depends on the version of Mathcad. In Mathcad 11 and before this is not a problem:

This functionality was broken with Static Unit Checking (Mathcad 12?) and it still is impossible in Mathcad 15 if I'm right. In Prime it's possible again:

The problem in Mathcad 11 (and versions before and after) is that you cannot have mixed units in an array. That's possible in Prime too. This is one of the few areas I think where Prime is superior to Mathcad.

Success!

Luc

Nov 19, 2017
08:02 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 19, 2017
08:02 AM

Yes, you are right. It was the introduction of SUC which had broken that behavior in the later version of Mathcad.

We don't know if ariperry is using Prime or Mathcad. If he is using Prime, he indeed could use this solution again.

Nov 19, 2017
08:43 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 19, 2017
08:43 AM

He's using Prime 4 (He complains about the READEXCEL function of Prime 4.0 not transferring units...).

Luc

Nov 19, 2017
10:19 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 19, 2017
10:19 AM

@LucMeekes wrote:

He's using Prime 4 (He complains about the READEXCEL function of Prime 4.0 not transferring units...).

Luc

Hmm, reading more thoroughly what people are writing really makes things clearer sometimes 🙂

Obvioulsy I was too hasty.

Nov 19, 2017
10:12 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 19, 2017
10:12 AM

To work seriously with units, you could implement this function in Prime:

You'll need the attached .CSV file with it.

Success!

Luc

Nov 19, 2017
10:51 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 19, 2017
10:51 AM

Ok, Here's the function for Prime (4.0). It works in Express Prime, thanks to the fact that Prime allows mixed units in an array or matrix.

Success!

Luc

Corrected, the atto's need to be in between the zepto's and the femto's

The Prime file is corrected.

Also added genuine Omega's, next to Ohms.

===> There's an updated version below!

Nov 19, 2017
01:51 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 19, 2017
01:51 PM

Revisited for a more generic solution.

This should cover all SI units.

The above is to create a UNITS table.

The GetUnit() function definition and a few of its usage examples is below:

And the file attached contains the Prime 4 stuff completely.

Success!

Luc