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

unexpected File Read/Write result...

pharbour
1-Newbie

unexpected File Read/Write result...

I am experiencing an issue I have not seen before. I am using MC2000Pro and I am reading data into an array via File Read from a file. I am reading in data from a csv file. The overall process is succesful. However, I see that some values are read in incorrectly. The data file contains floating point values with a 13 digit mantissa "x.xxxxxxxxxxxxx" (no exponent) and those are read correctly. In addition the file contains floating point values with exponents, those have an 11 digit mantissa "x.xxxxxxxxxxxE-xx" and have magnitude on the order of E-06. The File Read function is erroring such that if the value reads

-3.18151582573E-05

the result stored in the array is -3.182, the exponent is lost. Thus the value has a huge magnitude error.

I have not seen this before and have read in many csv files with scientific floating point numbers using the File Read function. But, the files I a working with now do appear to have a larger mantissa. I have tried manually editing the file to reduce the value's mantissa to 10 digits for those values with a scientific exponent and then Mathcad reads the value in correctly.

I have tried to adjust the setting PRNPRECISION within Math Options, but this does not solve the problem. It's max size in MC2000Pro is 16. I think this affects how data is written to a file though, not how it is read in?

Is there a known limitation with the text length of a value's mantissa within a file where the exponent portion of the value will be discarded?

Can I change a setting to overcome this?

Thanks,

Pete

4 REPLIES 4
MikeArmstrong
5-Regular Member
(To:pharbour)

Can you post an example file?

It is a lot easier to work on a problem if an example is in front of you.

Mike

Mike,

I have found something out looking at this. Using READPRN I can read an array in correctly.

I mis-spoke in my 1st message, I was using a Read component (not a function to read in a data array from a file).

There is text in the 1st line of my input file. Read component converts this text to 0s in the array. READPRN ignores the text completely and starts the array with the 1st numeric values.

I would like to use Read component since it is easier to select data input files with the browse GUI. But, READPRN does appear to handle the scientific values with long mantissa and exponents.

I have attached a csv file that contains 3 values with exponents that MC2000Pro reads incorrectly using the Read component,

line 130, 2nd element

line 135, 6th element

line 317, 3rd element

The input file creates an array 406 x 13.

The 1st line is comma separated text and is read in as zeros.

Please take a look.

I am assume Read component should work correctly too and I don't have something configured correctly?

Thanks,

Pete

MikeArmstrong
5-Regular Member
(To:pharbour)

I have never used MC2000Pro and therefore do not know what will and will not work.

Change the file path to your computer. The range which is to be extracted from the *.csv file is defines in Pages.

Mike

Screen shot of what I get.

Clipboard01.jpg

Mike

Top Tags