Skip to main content
5-Regular Member
August 16, 2014
Question

Stripping Units from Mathcad variables (e.g., for export to csv files)

  • August 16, 2014
  • 1 reply
  • 4939 views

Hi All

I enjoy the units features in Mathcad but find not being able to export them to excel or csv files frustrating. Is there a *simple* way to strip units from a mathcad variable array or matrix in preparation for export via WRITECSV for example?

Thanks Much

Bill

1 reply

25-Diamond I
August 16, 2014

Bill Capehart wrote:

Hi All

I enjoy the units features in Mathcad but find not being able to export them to excel or csv files frustrating. Is there a *simple* way to strip units from a mathcad variable array or matrix in preparation for export via WRITECSV for example?

Thanks Much

Bill

Simply divide the variable by its unit.

You may also use the function UnitsOf(variablename) or SIUnitsOf(variablename).

24-Ruby IV
August 17, 2014

Werner Exinger wrote:

Simply divide the variable by its unit.

You may also use the function UnitsOf(variablename) or SIUnitsOf(variablename).

Excel does it itself

ExcelUnits.png

25-Diamond I
August 17, 2014

But using the Excel component doesn't export the data to a file.

You could use the output of the component just to strip the units and then write the unitless data via WRITEEXCEl or WRITECSV, but that would be like taking a sledgehammer to crack a nut compared to simply dividing by the unit.

Of course you could double cick the component and manually chose "save file" from within Excel, but that wouldn't be automatic and a bit awkward, too.

So I guess dividing the matrix which should be written to a file by the desired unit will be the best approach.

1.png

If you use a matrix with elements of different dimensions in Prime, you will have to vectorize the division.

2.png