Thank you very much. It is working now!! Rafael
2012/9/24 Newaz <shne...@gmail.com> > HI > > try this code. I am attaching. > > > Regards > Newaz > > On 24 September 2012 18:37, Rafael P B Mota <rafaelpera...@gmail.com>wrote: > >> >> Hello, >> >> I am trying to connect a node called $reader1 to 30 other nodes. I tryed >> to >> write a for statemant but it is not working. >> >> >> This works: but with two nodes is very simple >> $ns connect $reader1 $tag_1 >> $ns connect $reader1 $tag_2 >> >> This is not working: >> for {set i 1} {$i < $val(nn)} { incr i } { >> $ns connect $reader1 $tag_$i >> } >> >> >> Error: >> >> can't read "tag_": no such variable >> while executing >> "$ns connect $reader1 $tag_$i" >> ("for" body line 2) >> invoked from within >> "for {set i 1} {$i < $val(nn)} { incr i } { >> $ns connect $reader1 $tag_$i >> }" >> (file "rfid4.tcl" line 118) >> >> >> The tag_ var is created at: >> >> for {set i 1} {$i < $val(nn)} { incr i } { >> set tag_$i [new Agent/RfidTag] >> } >> >> What should I do ? >> >> -- >> >> ---------------------------------------------------------------------------------------------------------------- >> Rafael Perazzo B Mota >> r <pera...@ime.usp.br>afaelpera...@gmail.com >> >> Web-page: https://sites.google.com/site/rafaelperazzo/ >> Doutorando em Ciência da Computação >> Universidade de São Paulo (USP) >> Campus da Capital >> Instituto de Matemática e estatística (IME) >> >> ------------------------------------------------------------------------------------------------------------------ >> >> >> >> >> -- >> >> ---------------------------------------------------------------------------------------------------------------- >> Rafael Perazzo B Mota >> r <pera...@ime.usp.br>afaelpera...@gmail.com >> >> Web-page: https://sites.google.com/site/rafaelperazzo/ >> Doutorando em Ciência da Computação >> Universidade de São Paulo (USP) >> Campus da Capital >> Instituto de Matemática e estatística (IME) >> >> ------------------------------------------------------------------------------------------------------------------ >> > > > > -- > > > Newaz > > Phd Candidate. > Broadband Network Lab(BNLab) > room no:T240 > Building: Truth Hall > > Korea Advanced Institute of Science and Technology(KAIST) > 119,Munjiro, Yuseong-gu, Daejeon,305-732, South Korea > > -- ---------------------------------------------------------------------------------------------------------------- Rafael Perazzo B Mota r <pera...@ime.usp.br>afaelpera...@gmail.com Web-page: https://sites.google.com/site/rafaelperazzo/ Doutorando em Ciência da Computação Universidade de São Paulo (USP) Campus da Capital Instituto de Matemática e estatística (IME) ------------------------------------------------------------------------------------------------------------------