both are different ways.
now suppose i have these values 6,3,... in a string variable
eg set my_string "6 3 ..."
i can set it to my_array in a for loop
but ,but
if i have my_string variable very big say 2048*512 (say)
then it will take long time to initialise in a for loop
so is there any other way by which i can optimise my time in
initialising array
can i initialise my 2-dimensional array through a string without for
loop
thankyou in advance
Actually you have several options:
1. Tcl arrays are actually collections of variables. The names of the
elements are up to your discretion, there is no relation between
them.
You can therefore initialise only those elements you really need.
2. You can use list of lists, this comes closer to C or Fortran arrays.
Lists are more efficient (in terms of memory and access time), if
you have large amounts of data.
3. If you want to manipulate numerical data stored in arrays, consider
using an extension like NAP (<http://wiki.tcl.tk/nap). There are
others that give you similar functionality, but I have some
experience with this one.
Regards,
Arjen
thanks in advance
In that case you will need an array indeed - Tktable expects an array
Regards,
Arjen
h> hi
h> i have read how in tcl we can use 2 dimensional arrays
h> like
h> set my_array(0,0) 6
h> set my_array(0,1) 3
h> ...
h> or
h> array set my_array1 { 0,0 6 0,1 3}
You do understand that this is not really a 2 dimensional arrays. In
Tcl an 'array' is not an indexed sequence of values (in the sense of C
arrays). A Tcl 'array' is really a hash table.
h>
h> both are different ways.
h> now suppose i have these values 6,3,... in a string variable
h> eg set my_string "6 3 ..."
h> i can set it to my_array in a for loop
h> but ,but
h> if i have my_string variable very big say 2048*512 (say)
h> then it will take long time to initialise in a for loop
h>
h> so is there any other way by which i can optimise my time in
h> initialising array
h> can i initialise my 2-dimensional array through a string without for
h> loop
h>
h> thankyou in advance
h>
h>
\/
Robert Heller ||InterNet: hel...@cs.umass.edu
http://vis-www.cs.umass.edu/~heller || hel...@deepsoft.com
http://www.deepsoft.com /\FidoNet: 1:321/153