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

Home » Public Forums » archive » Summer "English" heat or just me: Array slicing
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Summer "English" heat or just me: Array slicing [message #85299] Tue, 23 July 2013 08:51 Go to previous message
ameigs is currently offline  ameigs
Messages: 12
Registered: March 2009
Junior Member
I'm betting this is too easy, but having been away from my work computer for several weeks I think dementia has set in:

Here's a simple array:
IDL> a = [[1,2,3,4,5,6],[7,8,9,10,11,12]]
IDL> help, a
A INT = Array[6, 2]
IDL> print, a
1 2 3 4 5 6
7 8 9 10 11 12

I want to get just the indices of dim 0 and dim 1 I need from a list of indices. So I tried this:
IDL> print, a[[0,3,5],[0]]
% All array subscripts must be same size. Var = A

But this works
IDL> print, a[[0,3,5],0]
1 4 6
IDL> print, a[[0,3,5],1]
7 10 12
IDL>
IDL> print, a[[0,3,5],0:1]
1 4 6
7 10 12
IDL>
And this does not:
IDL> print, a[[0,3,5],[0,1]]
% All array subscripts must be same size. Var = A
% Execution halted at: $MAIN$

What have I forgotten?

Andy
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Thickness of /box_axes?
Next Topic: Dashed linestyle in vectorized function graphics output, IDL 8.2.3

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

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

Total time taken to generate the page: 0.00435 seconds