Skip to main content
May 26, 2021 3:01 PM UTC
Question

READPRN issu

I am using Mathcad Prime 6.0 6.0.0.0

the READPRN function does not work anymore in v6 & 7 with examples that work in v5 with csv files or text files that contain a header like this:
X Y
1e-005 0.00779719
2.05353e-005 0.0150519
4.21697e-005 0.0275974
8.65964e-005 0.0454306
0.000177828 0.0764726
0.000365174 0.12238
0.000749894 0.18147
0.00153993 0.263648
0.00316228 0.366576
0.00649382 0.464957
0.0133352 0.541029
0.0273842 0.58986
0.0562341 0.6044
0.115478 0.609997
0.237137 0.611843
0.486968 0.611179
1 0.609281


Could you help me to correct this?

Here are the errors that I faced
input/output error

    1 reply

    3-Newcomer
    May 26, 2021 5:16 PM UTC

    Yes, they changed the function(ing) of READPRN.

    READPRN used to work with this kind of files (A textual header above the table of numbers) since MathCad 8 or earlier. One more thing broken by PTC.

    I guess now you have to use

    READTEXT("filename","delimited"," ")

    And then you have to strip off the first row of the result array.

    Which means you can write your own READPRN, like this:

    LucMeekes_0-1622049784193.png

    The function StripHeader() checks if the first element of matrix M is a string, if so, it strips off its first row.

    This function is used by:

    LucMeekes_1-1622049794091.png

    Now use it:

    LucMeekes_0-1622050065659.png

    and plot:

    LucMeekes_1-1622050082227.png

     

    Success!
    Luc