Skip to main content
13-Aquamarine
August 7, 2025
Solved

Sort through a text file.

  • August 7, 2025
  • 2 replies
  • 1463 views

I have a set of commands that sort through a text file to get values, make some of those values a number and then name those values.  (See Attached).  When I calculate the sheet, I can literally see Prime paint the values into my sheet.  Is there a faster way?

Best answer by Werner_E

But the includes would only be done once. After that extracting the values via the GetValue5S1 function should be quite fast without you literally seeing how Prime paints the values.

It might speed up (but only a very little bit) if you do the conversion from string to numbers only once for all the data and not in the GetValue function.

Werner_E_1-1754582684064.png

 

I don't think that I can say any more about your experiencing such a slow performance without actually seeing the sheet(s).

 

2 replies

25-Diamond I
August 7, 2025

Whats the dimensions of matrix ID5_S1, how many rows?

Shouldn't be so slow normally.

13-Aquamarine
August 7, 2025

It is 270 rows long.  It might be slow because the file does an INCLUDE statement 4 times before it does the text file processing.

Werner_E25-Diamond IAnswer
25-Diamond I
August 7, 2025

But the includes would only be done once. After that extracting the values via the GetValue5S1 function should be quite fast without you literally seeing how Prime paints the values.

It might speed up (but only a very little bit) if you do the conversion from string to numbers only once for all the data and not in the GetValue function.

Werner_E_1-1754582684064.png

 

I don't think that I can say any more about your experiencing such a slow performance without actually seeing the sheet(s).

 

21-Topaz II
August 7, 2025

Hi Bob,

Use the WRITEPRN() and READPRN() functions as they can handle both strings and values in a matrix.

This will simply the GetValue() function and it will be faster. 

 

// Datafile written by Mathcad
// 08/07/25 13:46:36

.MATRIX 0 0 4 2
"ZiANG" 83.9 "Z0MAG" 4.78 "Z0ANG" 81.5 "LOCAT" "Y"

 

Cheers

Terry

21-Topaz II
August 7, 2025

And even faster.

13-Aquamarine
August 7, 2025

I'm not sure this will work as all the data I get from the text files are strings.  I have to turn a lot of the string data into numbers for future processing.