hi

I am not able to collect the traces using trace-all command in NS2 (on
windows):

Here is a snapshot of my file

#Create a simulator object
set ns [new Simulator]

#Open the Trace file
set tracefile1 [open out.tr w]
$ns trace-all $tracefile1

#Open the nam trace file
set nf [open out.nam w]
$ns namtrace-all $nf

proc finish {} {
        global ns nf
        $ns flush-trace
    #Close the trace file
        close $tracefile1
        close $nf
    #Execute nam on the trace file
        exec nam out.nam &
        exit 0
}

----rest of file

But there is an error when I run this

$ ns example4a.tcl
ns: finish: can't read "tracefile1": no such variable
    while executing
"close $tracefile1"
    (procedure "finish" line 5)
    invoked from within
"finish"

I would really appreciate if anyone could help me out with this error?
I am able to open the nam file using the open command but I am not able to
find out why tracefile1 is not getting created.

Regards
Kanu

Reply via email to