[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Array manipulation (typo fixed)



That should be:


 ; create a test case here
 a = indgen(12,15)
 ncols = (size(a))(1)


 ; Assumes square pieces
 piecesize = 3 ; size of the square subarray (i.e. piecesize  by piecesize)
 srow = 1 ; which row of the possible subsets
 scol = 2 ; which column of the possible subsets

 indices = indgen(piecesize,piecesize) +(intarr(piecesize) + 1) #
 indgen(piecesize) * (ncols - piecesize) +piecesize*srow*ncols +
 scol*piecesize
 subarray = a(indices)
 help,subarray
 print,subarray
end



(I had a "b" instead of "subarray" in two fo the lines,
because I am a moron.)

Cheers,
bob stockwell
stockwel (at) co-ra.com