./
pp_writepars.pro
Routines
top source pp_writepars
pp_writepars, file, ipars [, formats=formats] [, order=order] [, header=header]
Writes a text parameter file from the given hash. The file will contain one line per hash element, in the form key=value.
The complement to this procedure is pp_readpars
. For compatibility with
pp_readpars
, header lines should be comment lines (start with the comment
marker), and the keys in the hash should be strings (if not they will get
converted to strings in the output file, and the conversion may not be done
in a desirable way).
Parameters
- file in required
A string with the name of the file to create.
- ipars in required
A hash with the values to write in the file.
Keywords
- formats in optional
Either a scalar string, specifying the format to use for all file lines, or a hash of strings, with the same keys as the hash of values, each giving the format to use for the correponding line.
- order in optional
An array or list of keys to the parameter hash, sepcifying the order in which the elements whould be written to the file. If not provided, no ordering is made.
- header in optional
If given, its contents are printed on the top of the file. Useful for headers (for compatibility with
pp_readpars
, header lines should be comments).
Examples
Make up a simple set of parameters and write them with a comment line:
pars=hash()
pars['a']=9d0
pars['aa']=-17
pars['b']="'some string'"
pp_writepars,'pp_writepars_example.txt',pars,header='#some comment'
#some comment
a= 9.0000000
b='some string'
aa= -17
Author information
- Author:
Paulo Penteado (pp.penteado@gmail.com), Feb/2011
Statistics
Lines: | 22 lines |
Cyclomatic complexity: | 10 |
Modified cyclomatic complexity: | 6 |
File attributes
Modification date: | Wed Jun 29 22:15:28 2016 |
Lines: | 22 |
Docformat: | rst rst |