Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat is wrong with this statement
    text
    copied!<pre><code> for {set count 0} {$count&lt;$num_of_UEs} { incr count } { puts $count set tcp$count [new Agent/TCP] #$tcp$count set fid_ $count #$tcp$count set prio_ 2 } </code></pre> <p>My problem is with the line<code>#$tcp$count set fid_ $count </code> When I try to execute it it says</p> <pre><code> can't read "tcp": no such variable while executing "$tcp$count set fid_ $count" ("for" body line 4) invoked from within "for {set count 0} {$count&lt;$num_of_UEs} { incr count } { puts $count set tcp$count [new Agent/TCP] $tcp$count set fid_ $count $tcp$coun..." </code></pre> <p>It says Can't read tcp, well it shouldnt read tcp it should read it as tcp0 in the first iteration and tcp1 in the second and so on. What amI doing wrong?</p> <p>thanks</p> <p>EDIT:</p> <p>I tried using arrays, thanks for the TIP. It worked for most parts but in one specific case when I did this:</p> <pre><code> for {set count 0} {$count&lt;$num_of_UEs} { incr count } { set ftp($count) [new Application/FTP] $ftp($count) attach-agent $tcp($count) } </code></pre> <p>It gives me the following error:</p> <pre><code>Came here 0 (_o180 cmd line 1) invoked from within "_o180 cmd target _o99" invoked from within "catch "$self cmd $args" ret" invoked from within "if [catch "$self cmd $args" ret] { set cls [$self info class] global errorInfo set savedInfo $errorInfo error "error when calling class $cls: $args" $..." (procedure "_o180" line 2) (SplitObject unknown line 2) invoked from within "$agent target [[$self node] entry]" (procedure "_o98" line 2) (RtModule attach line 2) invoked from within "$m attach $agent $port" (procedure "_o97" line 4) (Node add-target line 4) invoked from within "$self add-target $agent $port" (procedure "_o97" line 15) (Node attach line 15) invoked from within "$node attach $agent" (procedure "_o3" line 2) (Simulator attach-agent line 2) invoked from within "$ns attach-agent $node2 $tcp($count)" ("for" body line 3) invoked from within "for {set count 0} {$count&lt;$num_of_UEs} { incr count } { puts "Came here $count" $ns attach-agent $node2 $tcp($count) }" (file "hsexample.tcl" line 104) </code></pre> <p>I know its a long one, but I would really appreciate your help</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload