printLinkValues - prints values for specified links to a file


    printLinkValues <file> <printProc> <group-list1> <group-list2>
        [-type <link-type> | -append]


This command is used to print information about links to a file. The first list of groups is the "senders" and the second list is the "receivers". The printProc Tcl procedure will be called once for each link from a sender to a receiver. If a link type is given, only links of that type will be printed.

The printProc procedure should take six arguments. These are: the sending group path, the sending unit path, the receiving group path, the receiving unit path, the number of the link's block, and the number of the link in the receiving unit's incoming array.

The string returned by each call to the procedure will be written to the file. The user, thus, determines the format of the output. The format Tcl command may come in very handy here.

The file can be specified using 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 printLinkValues 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.

Links to lesioned units are ignored when the values are printed.


In this example, the sending unit name, receiving unit name, and link weight are printed for every link of type "special" leaving the groups "input" and "hidden". The output is sent to standard output.

    lens> proc printStuff {g1 u1 g2 u2 b l} {
            format "%s->%s %.3f\n" [getObj $] [getObj $] \
              [getObj $u2.incoming($l).weight]
    lens> printLinkValues - printStuff {input hidden} * -t special



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