cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

writing a CSV file that has UNITS

rscott
6-Contributor

writing a CSV file that has UNITS

So i am trying to use the WriteCSV() function

When my my array im writing out does not have units it seems to work

When it does have units i get an error! 

 

Please tell me i dont have to go delete all the units.

1 REPLY 1
LucMeekes
23-Emerald III
(To:rscott)

In Mathcad Prime the function WriteCSV does not exist, but WRITECSV does exist, and it accepts no units.

LucMeekes_0-1599683167169.png

 

You have to strip them off.

The reason for it not accepting units is probably, to make the user aware that writing out united values to a CSV file (or any other file format that does not work with units, such as MsExcel...) is to be done with great caution. Example matrix with units:

LucMeekes_1-1599683517758.png

YOU, as a user, have to provide the conversion, so you know how the (unitless!) numbers in the .CSV file are to be interpreted.

The best way to strip them off, is to divide the matrix by the unit that you want them to be:

LucMeekes_5-1599683791392.png

The data in the .CSV file can be read back immediately after the WRITECSV statement is executed (but the WRITECSV function itself already did it upon execution...)

LucMeekes_4-1599683784035.png

Success

Luc

 

Top Tags