R
Ryan Jamison
I'm trying to build a 2D array by reading & picking out text from a separate
text file. Best way to describe what I am doing is an example:
I have a file called input_deck that is the main file that I am using and
wanting to edit. But in order to edit the file, I need information from
another file called materials.txt. Problem is materials.txt looks like:
$ Material Record: Aluminum
MAT1 3
$ Material Record: Steel
MAT1 2
$ Material Record: Copper
MAT1 1
And I need to build an array (or similar) that contains the Material name
(Aluminum, Steel, etc) and number (the number after MAT1). Ideally, it would
be something like:
3 Aluminum
2 Steel
1 Copper
Then I would use this array for editing purposes in my original file,
input_deck. So, is there a way to do anything like this, with my working
file being the original file? Any suggestions or hints would be greatly
appreciated! Thanks
Ryan
text file. Best way to describe what I am doing is an example:
I have a file called input_deck that is the main file that I am using and
wanting to edit. But in order to edit the file, I need information from
another file called materials.txt. Problem is materials.txt looks like:
$ Material Record: Aluminum
MAT1 3
$ Material Record: Steel
MAT1 2
$ Material Record: Copper
MAT1 1
And I need to build an array (or similar) that contains the Material name
(Aluminum, Steel, etc) and number (the number after MAT1). Ideally, it would
be something like:
3 Aluminum
2 Steel
1 Copper
Then I would use this array for editing purposes in my original file,
input_deck. So, is there a way to do anything like this, with my working
file being the original file? Any suggestions or hints would be greatly
appreciated! Thanks
Ryan