Because that might be subtle to see if you're not looking closely, and you mentioned a MATLAB background, note that there is an additional dot before the comparison operator--Julia uses the elementwise operator notation for comparison operators as well as for elementwise multiplication and division. Unlike their primitive arithmetical counterparts, though, that notation is mandatory for comparison operators even when one argument is scalar.
On Friday, August 15, 2014 9:01:57 AM UTC-5, John Myles White wrote: > > a .< 5 > > > On Aug 15, 2014, at 3:53 AM, David Higgins <[email protected]> > wrote: > > > Hi, > > > > Is there a mechanism for vectorised logical access to array elements in > Julia? I basically mean, is there an equivalent to the Matlab notation > > a[a<5] > > which should give all of the elements of a[] which have value less than > 5. > > > > I guess the feature I've not found is the ability to create the boolean > index vector 'a<5'. I'm doing it with loops at present. > > > > Thanks, > > David. > > > >
