2

I got the error message wrong # args: should be "for start test next command when trying to run the following code:

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

#Create 50 nodes

for {set i 0} {$i<51} {incr i} {

set n($i) [$ns node]
}

#Create a duplex link between the nodes
$ns duplex-link $n0 $n1 1Mb 10ms DropTail
slebetman
  • 109,858
  • 19
  • 140
  • 171
user3428116
  • 21
  • 1
  • 2
  • What is assigned to the variable `ns`? – E.Z. Mar 17 '14 at 09:30
  • 4
    Is that code **exactly** as you entered it? You cannot put the opening brace of the for statements code block on a separate line for instance. The code as pasted looks ok. – patthoyts Mar 17 '14 at 09:34
  • I agree with @patthoyts, but does the code produce a Tcl stack trace with that error? Those are usually pretty informative. (If not — perhaps because you're trapping it with `catch` or you're working interactively — the stack trace will be in the `errorInfo` global variable.) – Donal Fellows Mar 17 '14 at 09:52
  • 1
    Note that the loop will create 51 nodes, numbered from 0 to 50. – Peter Lewerin Mar 17 '14 at 15:42

0 Answers0