How to manipulate data that is not rectangular

1 次查看(过去 30 天)
I have a program that outputs spectroscopic data that has different widths throughout. I know how to extract values from the output using Unix scripts, but I don't know how to load the data into MATLAB.
So far I have tried the fileread, importdata, readfile, and textscan functions, but the resultant variable becomes too difficult to work with. Is there a good way to handle this data?
Below is an example of the output from the spectroscopy program. Unfortunately, the data was unable to paste properly, so the table wrapped text.
# Fitting sample as norm(E) from -20.000 to 63.000
#
# Fit included 159 data points and 7 variables
# R-factor = 0.010146
# chi-square = 1.14944
# reduced chi-square = 0.0075621
#
# group weight
# =======================================
# 12: standard1 0.000(0.333)
# 14: standard2 0.000(0.544)
# 7: standard3 0.000(0.311)
# 9: standard4 0.880(0.325)
# 5: standard5 0.000(0.056)
# 13: standard6 0.120(0.211)
# 15: standard7 0.000(0.471)
# 2: standard8 0.000(0.937)
#
#
# group e0 shift
# =======================================
# 12: standard1 0.000( 0.000)
# 14: standard2 0.000( 0.000)
# 7: standard3 0.000( 0.000)
# 9: standard4 0.000( 0.000)
# 5: standard5 0.000( 0.000)
# 13: standard6 0.000( 0.000)
# 15: standard7 0.000( 0.000)
# 2: standard8 0.000( 0.000)
# ----------------------------------------
# energy data fit residual standard1 standard2 standard3 standard4 standard5 standard6 standard7 standard8
7100.500 -0.00193 0.00095 -0.00288 -0.00000 0.00000 0.00000 0.00120 0.00000 -0.00025 0.00000 0.00000
7101.000 0.00001 0.00106 -0.00105 0.00000 0.00000 0.00000 0.00061 0.00000 0.00045 0.00000 0.00000
7101.500 0.00477 0.00001 0.00476 0.00000 0.00000 -0.00000 0.00021 -0.00000 -0.00020 0.00000 0.00000
7102.000 0.00002 -0.00008 0.00010 0.00000 -0.00000 -0.00000 -0.00033 -0.00000 0.00025 0.00000 0.00000
7102.500 0.00036 -0.00120 0.00156 0.00000 -0.00000 -0.00000 -0.00085 -0.00000 -0.00035 -0.00000 -0.00000
7103.000 0.00100 -0.00103 0.00202 -0.00000 -0.00000 -0.00000 -0.00099 -0.00000 -0.00003 -0.00000 0.00000
7103.500 -0.00373 -0.00099 -0.00274 0.00000 -0.00000 -0.00000 -0.00090 -0.00000 -0.00009 -0.00000 -0.00000
7104.000 -0.00089 -0.00069 -0.00020 -0.00000 -0.00000 -0.00000 -0.00081 0.00000 0.00012 -0.00000 0.00000
7104.500 -0.00512 -0.00000 -0.00512 -0.00000 -0.00000 -0.00000 -0.00055 0.00000 0.00055 -0.00000 0.00000
7105.000 0.00158 -0.00024 0.00182 -0.00000 -0.00000 -0.00000 0.00032 0.00000 -0.00056 -0.00000 0.00000
7105.500 0.00393 0.00220 0.00173 -0.00000 -0.00000 -0.00000 0.00210 -0.00000 0.00010 -0.00000 0.00000
7106.000 -0.00160 0.00537 -0.00697 -0.00000 -0.00000 -0.00000 0.00526 0.00000 0.00011 0.00000 0.00000
7106.500 0.00540 0.01171 -0.00630 0.00000 -0.00000 -0.00000 0.01115 0.00000 0.00056 0.00000 0.00000
7107.000 0.01107 0.02224 -0.01117 -0.00000 0.00000 0.00000 0.02214 0.00000 0.00010 0.00000 0.00000
7107.500 0.01752 0.04366 -0.02614 0.00000 0.00000 0.00000 0.04243 0.00000 0.00123 0.00000 0.00000
7108.000 0.02418 0.07884 -0.05466 0.00000 0.00000 0.00000 0.07747 0.00000 0.00137 0.00000 0.00000
7108.500 0.06029 0.12910 -0.06881 0.00000 0.00000 0.00000 0.12790 0.00000 0.00120 0.00000 0.00000
7109.000 0.12114 0.18619 -0.06505 0.00000 0.00000 0.00000 0.18429 0.00000 0.00190 0.00000 0.00000
7109.500 0.16079 0.23288 -0.07209 0.00000 0.00000 0.00000 0.23124 0.00000 0.00164 0.00000 0.00000
  2 个评论
Walter Roberson
Walter Roberson 2012-6-27
Are the lines with # all to be ignored? If so then it _looks_ like what is left is constant 12 fields per line ?
Aditya Shivprasad
Aditya Shivprasad 2012-6-27
I actually need some data from the lines with # as well.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Chemistry 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by