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

Home » Public Forums » archive » Features of the colon operator
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Features of the colon operator [message #94388] Sun, 07 May 2017 04:10
Matthew Argall is currently offline  Matthew Argall
Messages: 286
Registered: October 2011
Senior Member
An interesting feature of the colon operator caught me by surprise. Using the two examples from the IDL help page

www.harrisgeospatial.com/docs/Creating_Arrays.html


IDL> Help, [[1:5], [6:10], 11, [11:16], 17, 18, 19, 20, [21:30]]
<Expression> INT = Array[31]
IDL> Help, [[10:19], [20:29], [30:39]]
<Expression> INT = Array[10, 3]


The first example results in an Nx1 array while the second example results in an Nx3 array despite the similarity in appearance. The latter is consistent with non-colon-operator array concatenation, the former is not. It gets more complicated when I want to combine an Nx1 with an Mx1 array to get an Lx1 array.

IDL> Help, [ 0:10:0.1, 0:10:0.5 ]
^
% Illegal array creation syntax.

IDL> Help, [ [0:10:0.1], [0:10:0.5] ]
% Unable to concatenate variables because the dimensions do not agree: <FLOAT Array[21]>.
% Execution halted at: $MAIN$



To get the Lx1 array, I have to do one of the following


IDL> Help, Reform( [ [Transpose([0:10:0.1])], [Transpose([0:10:0.5])] ] )
<Expression> FLOAT = Array[122]


IDL> Help, [ [0:10:0.1], !Null, [0:10:0.5] ]
<Expression> FLOAT = Array[122]
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: area of symmetric differences of contours
Next Topic: area threshold

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

Current Time: Wed Oct 08 07:14:19 PDT 2025

Total time taken to generate the page: 0.00435 seconds