Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
I use Mathcad 15.0 to do analysis of multichannel files. The files are fairly large (ie. 10 MB text files).
Unfortunately I encountered a bug in Mathcad 15.0 memory management that cause Mathcad to crash everytime I open a file due to the 32 bit limitations of how Mathcad was designed. The bug has been logged however PTC indicated that Prime should be able to fix it. So I've eagerly anticipate Prime 2.0. I just installed it and have tried to work with.
Unfortunately, from what I can tell Mathcad Prime is very inefficient at file manipulation and processing large data sets. My data import wizards were covered to READTEXT, and it took Prime 5 minutes to load the file. The same file which takes less than 30 seconds in Mathcad 15.0 to load and display. I then wasn't able to scroll on the screen for additional 4 minutes.
I've holding off migrating our company to Diadem because of the learning curve to custom program and since Prime was approaching but this Prime is completely unwieldy. At least with Mathcad 15.0 I could manage complete the data analysis and just save often.
Is there anything I'm missing that would make Prime faster?
Ed Kamblulow wrote:
I use Mathcad 15.0 to do analysis of multichannel files. The files are fairly large (ie. 10 MB text files).
... The same file which takes less than 30 seconds in Mathcad 15.0 to load and display. I then wasn't able to scroll on the screen for additional 4 minutes...
You really need to display so large data on the screen?
I don't view it all but I do view several channel simultaneously. We sample vibration on multichannels at 250 Hz for 5 minutes. I view the data set to determine at time intervals we've reached steady state. I then select the rangel to perform a PSD analsyis and then display the results. Finally I perform some summary computations (RMS, average,etc) on the selected channels which I export to Excel.
Even if I reopened the file individually to view each channel independently, Mathcad Prime seems to have very slow file parsing as it takes 5 minutes just to read the file (less than 30 seconds in Mathcad 15) and I can't see that saving time. I would need to open the file more times instead of just once to - reloading the same data multiple times to complete the analysis, viewing and calculating on each channel.
I think fundamentally I need Mathcad Prime to be faster at file parsing (5 minutes is ridculously slow for a 10 MB file) for it to be usable.
An image is better than 1000 words..
Ed Kamblulow wrote:
I don't view it all but I do view several channel simultaneously. We sample vibration on multichannels at 250 Hz for 5 minutes. I view the data set to determine at time intervals we've reached steady state.
Couldn't you determine that range using a mathcad-program so you would not be forced to display the matrices and scroll through them?
I have the same issue with 90Mb flight test files.
Mathcad 14 takes about 30 seconds to load them, Prime 2.0 needs 50 minutes so that is a show stopper for me.
I reported it as a bug, they could duplicate it so hopefully this will be addressed with the next release.
Thanks. Glad to hear you reported it. I was going to log this with PTC but if you've already done that then I guess there's no need.
Its funny - the feature comparison that the marketing dept created doesn't quite show the entire picture. The lack of drop downs, the lack of highlighting, the lack of right click dialogs doesn't make Prime very easy to use in comparison to 15.0. Even the the conversion results from Mathcad 15 means its not just opening old files and viewing - but you have to readjust/reformat the new converted file to use.
Don't plan on recommending Prime 2.0 for our internal use. Don't quite thinks its ready for Prime time.
The READTEXT and READFILE functions appear to be very slow for large data sets.
You may want to consider using READPRN or READCSV if possible, which seem to work much faster.
Wow, READPRN does make a huge difference! That took 15 seconds to load the same file. Only problem is that it can't handle a header file nor have the ability to skip the first few lines. (I had to manually delete the first few lines). I also have a date code which it struggled with. Only function that can handle tnese is READTEXT and READFILE -which are buggy.
I have hundreds of data files, all in different directories, in this format so manually modifying each them will be very labourous - in addition to me losing that header info. Is there any work around?
Since all of the data is read into a matrix (say M), you can calculate the length (number of rows) and then re-write it to another matrix (say N) without the headers by shifting the row indices by the number of header rows. And then you can write the headers to another matrix for posterity.
That was my initial thought. But, unforunately when you try to load the file with READPRN without truncating the initial headers it gives you the following error:
"Encountered a file I/O error. Check that you are not trying ot read in data points that do not exist in the file."
However,
I initially just tried with READPRN. If you try it with READCSV it works with only a couple minor glitches. I then imported my matrix M into an excel component and its formatted almost perfectly.
How do you export an unknown number of rows from an excel component?
You can also use the READFILE() function to skip header rows, although you may need to play with it a bit to get it to skip the correct number of header rows.
This year-old discussion regarding large datasets and readfile is now moot as this specific speed issue has been successfully resolved with M010.
Ed Kamblulow wrote:
I have hundreds of data files, all in different directories, in this format so manually modifying each them will be very labourous - in addition to me losing that header info. Is there any work around?
I wrote a VBscript that reads the file, chops off the lines with the headers, and re-writes it without them.
Here are the instructions:
Insert/Paste a scriptable control object like a "push button", right-click on it, and select "Edit Script".
Highlight the "PushBtnEvent_Exec" subroutine in the scripting window and replace it with this:
Sub PushBtnEvent_Exec(Inputs,Outputs)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile(Inputs(0).value, 1)
Set objFSO2 = CreateObject("Scripting.FileSystemObject")
Set objTextFile2 = objFSO2.OpenTextFile(Inputs(1).value, 2, True)
Set objFSO3 = CreateObject("Scripting.FileSystemObject")
Set objTextFile3 = objFSO3.OpenTextFile("Headers.txt", 2, True)
For I = 1 to Inputs(2).value
strNextLine = objTextFile.Readline
objTextFile3.WriteLine(strNextLine)
Next
Do Until objTextFile.AtEndOfStream
strNextLine = objTextFile.Readline
objTextFile2.WriteLine(strNextLine)
Loop
objTextFile.Close
objTextFile2.Close
objTextFile3.Close
End Sub
Close the scripting window.
Add two more input variables (three total) to the control object (by right-clicking on it). The name of the output variable (on the left side of the := sign) is not important for this application.
The first input parameter to the component (Inputs(0).value) is the name of the file with your source data. The second input parameter is the name of the trimmed (without headers) output file which should not be the same name as the source data file. The third input parameter is the number of header lines to remove.
The output value is not defined.
The header information is written to a separate file called "Headers.txt" for later processing if desired.
It can process 100,000 lines in a few seconds.
No more work-around kludges in MC15.
Unfortunately, Prime does not yet have components, but you can run the trimming script in MC15, and then transition to working in Prime.
Is there a difference between READPRN in Mathcad and Prime? Reding prns in Prime previously written by Mathad I see some [n x 1] matrices in Prime where I would expect having [n] vectors?
thanks