[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bad data in structure (NaN HowTo?)
Randall Skelton wrote:
> B = where(atrl eq -12345, count)
> % Struct expression not allowed in this context: ATRL.
I would try something like
;Loop for each field.
FOR I = 0, N_TAGS(atrl) - 1 DO BEGIN
type = size(atrl.(i), /type)
if (type lt 6) or (type gt 11) then begin
; Assume no undefined tags are present.
; If they are present, exclude type=0.
B = where(atrl.(i) eq -12345, count)
if count gt 0 then atrl.(i)[B] = !values.f_nan
For multiple numerical fields, I'd use a loop. Given relatively small
number of fields, this would not require vectorizing.
> Each structure has about 450 elements in it and is comprised itself of
> strings, ints, floats and doubles and arrays of each of the above.
In your case, I'd automate the search for numerical fields, because I
wouldn't be able to go through 450 fields myself. None of my business,
but are you sure this is the best way to organize the data?