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

Home » Public Forums » archive » Re: How to test for a vector/matrix of constants?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: How to test for a vector/matrix of constants? [message #51768 is a reply to message #51767] Wed, 06 December 2006 11:38 Go to previous messageGo to previous message
Braedley is currently offline  Braedley
Messages: 57
Registered: September 2006
Member
Mirko wrote:
> How can I quickly check if a vector/matrix is full of constants (all
> elements equal)?
> For example if a vector contained:
> [2.38,2.38,2.38,...,2.38]
> I want it flagged as a "constant" vector.
>
> I can think of finding differences between successive elements, and
> check for non-zero elements.
>
> Any faster options?
>
> Thanks,
>
> Mirko

Probably not as fast as the others, but

if n_elements(uniq(array, sort(array))) eq 1 then ;flag it

Braedley
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Martin Shultz's MSG_GUI
Next Topic: Re: histogram along y-axis

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

Current Time: Sat Oct 11 19:35:34 PDT 2025

Total time taken to generate the page: 1.84192 seconds