printUnitValues - prints values for each unit in a list of groups to a file


    printUnitValues <file> <printProc> <group-list> [-append]


This command is used to print information about units to a file. It traverses the units in the specified groups and calls the printProc Tcl procedure for each unit. The procedure should take two arguments: the path to the group object and the path to the unit object.

Whatever string the procedure returns will be written to the file. The user, thus, determines the format of the output. In fact, the format Tcl command may come in very handy here.

The file can use any of the standard Lens file types, including ordinary files, compressed files, pipelines, Tcl file handles, and a "-" for standard output. If you would like to periodically write values to a file, after each example for instance, you could open a Tcl file, call printUnitValues after each example (maybe using the network's postExampleProc) and then close the Tcl file, or simply use the -append flag, which causes the output to be appended to the file.

Lesioned units are ignored when the values are printed.


In this example, the group name, unit number, and unit output for every unit in the groups out1 and out2 are appended to the compressed file "helloKitty.gz":

    lens> proc printStuff {group unit} {
            format "%s %-3d %.3f\n" [getObj $] [getObj $unit.num] \
              [getObj $unit.output]
    lens> printUnitValues helloKitty.gz printStuff {out1 out2} -a



Last modified: Mon Jun 8.33:59:51 EDT 1998