Thanks a lot for the info.
It worked!

On Sun, Nov 16, 2008 at 12:20 PM, Waleed Tuffaha <[EMAIL PROTECTED]> wrote:

> Hello kanupriya,
>
> you have an error in proc finish {} , you didn't do 'global tracefile1' ,
> so the following adjustments to the finish proc should make it work:
>
>
> proc finish {} {
>        global ns nf *tracefile1*
>        $ns flush-trace
>    #Close the trace file
>        close $tracefile1
>        close $nf
>    #Execute nam on the trace file
>        exec nam out.nam &
>        exit 0
> }
>
>
>
>
> On Sun, Nov 16, 2008 at 4:15 AM, kanupriya kabra <[EMAIL PROTECTED]>wrote:
>
>>
>> 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
>>
>
>
>
> --
> Waleed Tuffaha.
>

Reply via email to