[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Help parsing a text file and assigning variables
From: |
Eric |
Subject: |
Help parsing a text file and assigning variables |
Date: |
Sat, 04 Jul 2015 14:06:20 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 |
Hello,
I am trying to read a simple spice netlist file into octave and assign
the variables listed with the values listed in the file. The file is a
text file.
An example of the file I am trying to import is:
------------------------------------------------------
V1 1 0 12
R1 1 2 1000
R2 2 0 2000
R3 2 0 2000
-------------------------------------------------------
I would like to read the file and automatically create and assign the
variables:
V1 = 12
R1 = 1000
R2 = 2000
R3 = 2000
where the first element of each line is the variable name and the fourth
element of each line is the value.
I have been looking through google and the octave documents for some
examples but have not been successful.
Thank you for any help.
Eric Meddleton
- Help parsing a text file and assigning variables,
Eric <=