comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Problem using the method List->ToArray()
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Problem using the method List->ToArray() [message #75971] Wed, 11 May 2011 08:02
natha is currently offline  natha
Messages: 482
Registered: October 2007
Senior Member
Hi folks,

I have a list containing 2885 structures of the same type. When I want
to convert the list to an array I get the following error:
% LIST::TOARRAY: Unable to convert to type STRUCT: Element 260

LOL ! All the elements are the same type so I don't see what's going
on.. Anyone experienced this ?

Here is how I verify if all the elements in the list are the same:

;; GETTING THE TAG NAMES AND TAG TYPES OF THE FIRST STRUCTURE
str_ntags=N_TAGS(data[0])

str_names=TAG_NAMES(data[0])
str_types=INTARR(str_ntags)

FOR i=0l, str_ntags-1 DO str_types[i]=SIZE(data[0].(i),/TYPE)

;; THE CODE WILL STOP IF ONE ELEMENT IS NOT EQUAL TO THE FIRST ONE
FOR i=0l, N_ELEMENTS(data)-1 DO BEGIN
aux_names=TAG_NAMES(data[i])
IF N_ELEMENTS(aux_names) NE str_ntags THEN STOP
FOR j=0l, str_ntags-1 DO BEGIN
IF aux_names[j] NE str_names[j] THEN STOP
IF str_types[j] NE SIZE(data[i].(j),/TYPE) THEN STOP
ENDFOR
ENDFOR

Thank you,
nata
[Message index]
 
Read Message
Previous Topic: make_dll and call_external woes
Next Topic: Plot3D bug in 8.1

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:53:57 PDT 2025

Total time taken to generate the page: 0.00466 seconds