julia> maximum([1,NaN])
NaN
julia> minimum([1,NaN])
NaN
julia> 1 > NaN
false
julia> 1 < NaN
false
…I have a rectangular matrix of (possibly complex) vectors, of which 2 elements have zero length – so I replace them with NaN for plotting reasons. Then I want to find the non-NaN element in this matrix of vectors with the largest real part.
To get your results you will have to filter or replace the NaN values. maximum(filter(!isnan,a)) #allocates maximum(x->isnan(x) ? -Inf : x,a) #non-allocating
Thanks. I tried to use missing instead, but the plot routine complained that it was not a Float. Not that I know whether that had worked better with maximum, though…