How do I extract data from an output file

3 views (last 30 days)
Teresa Tutt
Teresa Tutt on 15 Apr 2015
Commented: Jan on 16 Apr 2015
I am trying to write a script to extract the columnar data between
" cell: 65 "
and
"==================================================================================================================================="
And import it into an excel file. Also, to be able to just extract the second and third column, without the first ("energy") column.
Ehat I want to do is be able to search for the string " cell: 65 ", and then import the data below that.
Thanks!!
  2 Comments
Teresa Tutt
Teresa Tutt on 15 Apr 2015
Apparently the file did not upload. See below.
Thread Name & Version = MCNP5, 1.60
_
._ _ _ ._ ._ |_
| | | (_ | | |_) _)
|
1tally 58 nps = 64620865 + DETECTOR SPECTRUM CPS tally type 8 pulse height distribution. tally for photons
this tally is modified by cm, em or tm cards.
cell: 65
energy
0.0000E+00 0.00000E+00 0.0000
5.0000E-03 0.00000E+00 0.0000
1.0000E-02 1.20897E-10 1.0000
1.5000E-02 4.83590E-10 0.6124
2.0000E-02 1.20897E-10 1.0000
2.5000E-02 1.20897E-10 1.0000
3.0000E-02 0.00000E+00 0.0000
3.5000E-02 0.00000E+00 0.0000
4.0000E-02 1.20897E-10 1.0000
4.5000E-02 1.20897E-10 1.0000
5.0000E-02 1.20897E-10 1.0000
5.5000E-02 3.62692E-10 0.5774
6.0000E-02 8.88597E-09 0.1232
6.5000E-02 2.41795E-10 0.7071
7.0000E-02 2.76553E-09 0.1895
7.5000E-02 2.41795E-10 0.7071
8.0000E-02 2.41795E-10 0.7071
8.5000E-02 3.17356E-10 0.5813
9.0000E-02 5.13814E-10 0.4594
9.5000E-02 8.46282E-10 0.3580
1.0000E-01 1.11830E-09 0.3931
1.0500E-01 6.64936E-10 0.4746
1.1000E-01 1.40543E-09 0.2802
1.1500E-01 3.83850E-09 0.2531
1.2000E-01 3.32468E-09 0.2299
1.2500E-01 2.97710E-09 0.2070
1.3000E-01 1.75301E-09 0.2954
1.3500E-01 4.08029E-09 0.1990
1.4000E-01 2.93176E-09 0.2387
1.4500E-01 3.43047E-09 0.2365
1.5000E-01 4.88124E-09 0.2981
1.5500E-01 3.40024E-09 0.2236
1.6000E-01 1.64723E-09 0.2871
1.6500E-01 2.68997E-09 0.2876
1.7000E-01 2.82598E-09 0.2632
1.7500E-01 2.07037E-09 0.3166
1.8000E-01 1.61700E-09 0.3044
1.8500E-01 1.48099E-09 0.3378
1.9000E-01 1.79835E-09 0.2786
1.9500E-01 7.70721E-10 0.4807
2.0000E-01 3.47580E-10 0.5784
2.0500E-01 7.10273E-10 0.4087
2.1000E-01 3.32468E-10 0.7524
2.1500E-01 2.11571E-10 0.7143
2.2000E-01 0.00000E+00 0.0000
2.2500E-01 2.11571E-10 1.0000
2.3000E-01 1.05785E-10 1.0000
2.3500E-01 0.00000E+00 0.0000
2.4000E-01 1.20897E-10 1.0000
2.4500E-01 0.00000E+00 0.0000
2.5000E-01 0.00000E+00 0.0000
2.5500E-01 0.00000E+00 0.0000
2.6000E-01 0.00000E+00 0.0000
2.6500E-01 0.00000E+00 0.0000
2.7000E-01 0.00000E+00 0.0000
2.7500E-01 0.00000E+00 0.0000
2.8000E-01 0.00000E+00 0.0000
2.8500E-01 0.00000E+00 0.0000
2.9000E-01 0.00000E+00 0.0000
2.9500E-01 0.00000E+00 0.0000
3.0000E-01 0.00000E+00 0.0000
3.0500E-01 0.00000E+00 0.0000
3.1000E-01 0.00000E+00 0.0000
3.1500E-01 0.00000E+00 0.0000
3.2000E-01 0.00000E+00 0.0000
3.2500E-01 0.00000E+00 0.0000
3.3000E-01 0.00000E+00 0.0000
3.3500E-01 0.00000E+00 0.0000
3.4000E-01 0.00000E+00 0.0000
3.4500E-01 0.00000E+00 0.0000
3.5000E-01 0.00000E+00 0.0000
3.5500E-01 0.00000E+00 0.0000
3.6000E-01 0.00000E+00 0.0000
3.6500E-01 0.00000E+00 0.0000
3.7000E-01 0.00000E+00 0.0000
3.7500E-01 0.00000E+00 0.0000
3.8000E-01 0.00000E+00 0.0000
3.8500E-01 0.00000E+00 0.0000
3.9000E-01 0.00000E+00 0.0000
3.9500E-01 0.00000E+00 0.0000
4.0000E-01 0.00000E+00 0.0000
4.0500E-01 0.00000E+00 0.0000
4.1000E-01 0.00000E+00 0.0000
4.1500E-01 0.00000E+00 0.0000
4.2000E-01 0.00000E+00 0.0000
4.2500E-01 0.00000E+00 0.0000
4.3000E-01 0.00000E+00 0.0000
4.3500E-01 0.00000E+00 0.0000
4.4000E-01 0.00000E+00 0.0000
4.4500E-01 0.00000E+00 0.0000
4.5000E-01 0.00000E+00 0.0000
4.5500E-01 0.00000E+00 0.0000
4.6000E-01 0.00000E+00 0.0000
4.6500E-01 0.00000E+00 0.0000
4.7000E-01 0.00000E+00 0.0000
4.7500E-01 0.00000E+00 0.0000
4.8000E-01 0.00000E+00 0.0000
4.8500E-01 0.00000E+00 0.0000
4.9000E-01 0.00000E+00 0.0000
4.9500E-01 0.00000E+00 0.0000
5.0000E-01 0.00000E+00 0.0000
total 6.63727E-08 0.0569
===================================================================================================================================
results of 10 statistical checks for the estimated answer for the tally fluctuation chart (tfc) bin of tally 58
tfc bin --mean-- ---------relative error--------- ----variance of the variance---- --figure of merit-- -pdf-
behavior behavior value decrease decrease rate value decrease decrease rate value behavior slope
desired random <0.10 yes 1/sqrt(nps) <0.10 yes 1/nps constant random >3.00
observed random 0.06 yes yes 0.02 no no constant random 0.00
passed? yes yes yes yes yes no no yes yes no
===================================================================================================================================
warning. the tally in the tally fluctuation chart bin did not pass 3 of the 10 statistical checks.
run terminated when it had used 120 minutes of computer time.
computer time = 120.02 minutes
mcnp version 5 09282010 03/19/15 18:36:56 probid = 03/19/15 16:36:55
Jan
Jan on 16 Apr 2015
The question does not contains enough information. Do you know how to process a list of files? Is it enough to search for a 65 in the first two columns? How should the data exported to an Excel file? Should all values be copied to one sheet, to different columns etc?

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!