Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 2
Message 1 of 2

Can't read the variable value in the below mentioned "for" loop

Kindly help me with this error

Can't read "x(1)":no such variable
While executing
"expr $X($j) -$X($j)"
("for" body line 2 )
Invoked from within
"for {set j 1} {$j<= $val(nn)} {incr j} {
set dx [expr $X($j) -$X($j)]
set dy [expr $Y($j) -$X($j)]
puts stdout $dx
puts stdout $dy
}"
(file "ns1.tcl" line 74)
1 Reply
Pilot Lvl 2
Message 2 of 2

Re: Can't read the variable value in the below mentioned "for" loop

Without seeing your assignment to $X we won't be able to help. Off-hand, I'd think the error is telling you that your $X array does not have a value at index 1.