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

Home » Public Forums » archive » Problem array subscripting
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 array subscripting [message #16681] Mon, 16 August 1999 00:00 Go to previous message
GRI is currently offline  GRI
Messages: 2
Registered: August 1999
Junior Member
Hello everybody.

I have a little problem I want to solve using array subscripting (if
possible), but I haven't been able to do it without using a FOR
statement:

I have a 3D array (dimX, dimY, n_images), which represents a time-series

of images.
I have a masking image (dimX, dimY), from wich I extract some points I
am interested in (a ROI) with the command WHERE.

I could then change the one dimensional subscripts returned by WHERE
into two vectors, that give me the X and Y coordinates of the points.

What I want to do is:

index= INDGEN(n_images)
result= ARRAY[X, Y, index],

but I get an error:

% All array subscripts must be same size. Var = ARRAY.


I have read in the documentation I can't do

result= ARRAY[X,Y, 0:n_images-1]

because I get an (n,n,n_images); where n is the number of X (or Y)
coordinates array, instead of the expected (n,n_images) array. Acording
to IDL's help this combines each element in the first vector with all
elements in the second vector, so it would work for me if my points
where in a regular grid, but this is not the case!



With a FOR statement the solution would be easy:

n_points= N_ELEMENTS(X) ; number of points I am interested on.
result= FLTARR(n_points, n_images)
FOR i=0, n_points-1 DO $
result[i,*]= ARRAY[X[i], Y[i], 0:n_images-1]


Is there a way to solve it with array subscripts, or should I go ahead
with the FOR statement?.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Xwindow, TVimage and PostScript fonts
Next Topic: Re: bounds check in array subscripts

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

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

Total time taken to generate the page: 0.00355 seconds