Skip to main content
13-Aquamarine
Aug 7, 2025 1:43 AM UTC
Solved

Sort through a text file.

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?

Werner_E
Werner_EAnswer
25-Diamond I
Aug 7, 2025 4:00 PM UTC

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).

 

10 replies

Werner_E
25-Diamond I
Aug 7, 2025 2:19 AM UTC

Whats the dimensions of matrix ID5_S1, how many rows?

Shouldn't be so slow normally.

Translate
13-Aquamarine
Aug 7, 2025 3:20 PM UTC

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.

Translate
Werner_E
Werner_E25-Diamond IAnswer
25-Diamond I
Aug 7, 2025 4:00 PM UTC

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).

 

Translate
terryhendicott
21-Topaz II
Aug 7, 2025 3:57 AM UTC

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

Translate
terryhendicott
21-Topaz II
Aug 7, 2025 5:37 AM UTC

And even faster.

Translate
13-Aquamarine
Aug 7, 2025 3:27 PM UTC

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.

Translate