"splitting" an index [message #33318] |
Mon, 16 December 2002 08:39 |
Carsten Pathe
Messages: 5 Registered: December 2002
|
Junior Member |
|
|
Hello everybody,
may be it is a simple beginner-question, but anyway ...
How can I "split" an index to a value within a structure consisting of
several floating arrays to acess structure on one specific position?
This example should make it easier to understand, what I want to have:
strcut1 = {a: floatarr(20), b: floatarr(20)}
strcut2 = replicate(struct1, 10)
struct2[3].b[4] = 5
ind = where(struct.b eq 5)
I can�t use this index to acess the data at the correct position to get the
value 5 back. Somehow, I have to "split" the index into two parts.
That�s why I have this "work-around":
tmp = struct2[*].b[*]
ind = where(tmp eq 5)
tmp[ind] = ....... ;do something with the value
struct2[*].b[*] = tmp
Is there another, more elegant or faster way to do this?
Thank you very much for helping me!
Ciao, Carsten
|
|
|