I have a text file of this format:
L O A D C A S E 1 O F 2 ... J O I N T D I S P L A C E M E N T S (global) Joint X-dsp Y-dsp Z-dsp X-rot Y-rot Z-rot 1 0.0 0.0 0.0 0.0 0.0 -0.001712 2 0.000646 -0.021756 0.0 0.0 0.0 -0.001339 3 0.003562 -0.038487 0.0 0.0 0.0 -0.000727 4 0.006478 -0.041661 0.0 0.0 0.0 0.000104 5 0.009536 -0.036266 0.0 0.0 0.0 0.000720 6 0.012595 -0.022824 0.0 0.0 0.0 0.001326 7 0.014724 0.0 0.0 0.0 0.0 0.001948 8 0.010000 -0.018686 0.0 0.0 0.0 -0.001117 9 0.009354 -0.036887 0.0 0.0 0.0 -0.000829 10 0.005767 -0.041661 0.0 0.0 0.0 0.000060 11 0.002180 -0.035866 0.0 0.0 0.0 0.000798 12 0.000051 -0.020695 0.0 0.0 0.0 0.001210 M E M B E R E N D F O R C E S (local) Member Joint Nx Vy Vz Txx Myy Mzz 1 1 -16.138t 0.002 0.0 0.0 0.0 0.011 1 2 16.138t -0.002 0.0 0.0 0.0 0.017 2 2 -72.907t 0.003 0.0 0.0 0.0 0.013 2 3 72.907t -0.003 0.0 0.0 0.0 0.023 3 3 -72.909t -0.000 0.0 0.0 0.0 -0.009 3 4 72.909t 0.000 0.0 0.0 0.0 0.005 4 4 -76.455t -0.000 0.0 0.0 0.0 -0.007 4 5 76.455t 0.000 0.0 0.0 0.0 0.003 5 5 -76.453t -0.001 0.0 0.0 0.0 -0.010 5 6 76.453t 0.001 0.0 0.0 0.0 0.000 6 6 -53.226t -0.002 0.0 0.0 0.0 -0.018 6 7 53.226t 0.002 0.0 0.0 0.0 -0.008 7 1 108.570c -0.001 0.0 0.0 0.0 -0.011 7 8 -108.570c 0.001 0.0 0.0 0.0 -0.004 8 2 -76.765t -0.004 0.0 0.0 0.0 -0.024 8 8 76.765t 0.004 0.0 0.0 0.0 -0.021 9 2 80.278c -0.000 0.0 0.0 0.0 -0.006 9 9 -80.278c 0.000 0.0 0.0 0.0 -0.000 10 3 -39.997t -0.002 0.0 0.0 0.0 -0.014 10 9 39.997t 0.002 0.0 0.0 0.0 -0.016 11 4 -23.720t -0.000 0.0 0.0 0.0 0.004 11 9 23.720t 0.000 0.0 0.0 0.0 -0.007 12 4 -0.001t 0.000 0.0 0.0 0.0 0.002 12 10 0.001t -0.000 0.0 0.0 0.0 0.001 13 4 -18.706t 0.000 0.0 0.0 0.0 -0.003 13 11 18.706t -0.000 0.0 0.0 0.0 0.005 14 5 -10.000t 0.001 0.0 0.0 0.0 0.007 14 11 10.000t -0.001 0.0 0.0 0.0 0.008 15 6 32.845c 0.000 0.0 0.0 0.0 0.006 15 11 -32.845c -0.000 0.0 0.0 0.0 -0.000 16 6 -53.223t 0.002 0.0 0.0 0.0 0.012 16 12 53.223t -0.002 0.0 0.0 0.0 0.010 17 7 75.273c 0.000 0.0 0.0 0.0 0.008 17 12 -75.273c -0.000 0.0 0.0 0.0 -0.001 18 8 16.142c 0.005 0.0 0.0 0.0 0.025 18 9 -16.142c -0.005 0.0 0.0 0.0 0.030 19 9 89.682c 0.000 0.0 0.0 0.0 -0.007 19 10 -89.682c -0.000 0.0 0.0 0.0 0.008 20 10 89.682c -0.000 0.0 0.0 0.0 -0.009 20 11 -89.682c 0.000 0.0 0.0 0.0 0.003 21 11 53.228c -0.002 0.0 0.0 0.0 -0.016 21 12 -53.228c 0.002 0.0 0.0 0.0 -0.010
Is there any C# library that can be used to parse the information of this format?
Thanks.
Here is a very interesting approach about importing tabulated data using Linq.
It’s simple and elegant, you only need an Enumerable method that yields the lines from the file:
and then you do the query:
You have now a list of anonymous objects that have the values from your file, represented as properties of each object.
If your file includes the column headers, you should skip the first line…