Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
Array subscript for ARRAY must have same size as source expression
Hello I have the following code: ArrayNEW = ArrayDATA FOR i=0, n-1 do begin A1[i,*,*] = A1_tmp A2[i,*,*] = A2_tmp ArrayNEW[i,*,*] = calculate(A1_tmp,A2_tmp,ArrayDATA[i,*,*]) endfor The dimensions of the arrays are as follow: A1_tmp FLOAT = Array[120, 4, 4] A2_tmp FLOAT = Array[120, 4, 4] ArrayDATA FLOAT = Array[120, 216, 216] ArrayNEW FLOAT = Array[120, 216, 216] calculate - it's a function which takes those arguments and interpolate the A1_tmp,A2_tmp to have the same dimensions as ArrayDATA. As I send these arguments to the function why they should have the same dimensions?
Re: Array subscript for ARRAY must have same size as source expression
You don't say at which line the error is occurring, or at which line you are displaying the data sizes. Certainly one suspicious place is > A1[i,*,*] = A1_tmp where A1_tmp FLOAT = Array[120, 4, 4] So you are trying to assign all 3 dimensions of A1_tmp into the last two dimensions of A1. Maybe you wanted subscripts for A1_tmp ? --Wayne On Friday, March 27, 2015 at 7:36:41 AM UTC-4, g.na...@gmail.com wrote: > Hello > > I have the following code: > > ArrayNEW = ArrayDATA > > FOR i=0, n-1 do begin > A1[i,*,*] = A1_tmp > A2[i,*,*] = A2_tmp > ArrayNEW[i,*,*] = calculate(A1_tmp,A2_tmp,ArrayDATA[i,*,*]) > endfor > > The dimensions of the arrays are as follow: > A1_tmp FLOAT = Array[120, 4, 4] > A2_tmp FLOAT = Array[120, 4, 4] > ArrayDATA FLOAT = Array[120, 216, 216] > ArrayNEW FLOAT = Array[120, 216, 216] > > calculate - it's a function which takes those arguments and interpolate the A1_tmp,A2_tmp to have the same dimensions as ArrayDATA. > > As I send these arguments to the function why they should have the same dimensions?
Yeah, you are right. No the error is occurring in this line ArrayNEW[i,*,*] = calculate(A1_tmp,A2_tmp,ArrayDATA[i,*,*])
On Friday, March 27, 2015 at 9:24:07 AM UTC-4, g.na...@gmail.com wrote: > Yeah, you are right. No the error is occurring in this line > > ArrayNEW[i,*,*] = calculate(A1_tmp,A2_tmp,ArrayDATA[i,*,*]) Have you checked that the calculate() function is doing what you think it is doing?, i.e. after the program crashes, help, calculate(A1_tmp,A2_tmp,ArrayDATA[i,*,*])