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

Home » Public Forums » archive » Array into binary array
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: Array into binary array [message #86541 is a reply to message #86540] Mon, 18 November 2013 01:08 Go to previous message
Oliver Angelil is currently offline  Oliver Angelil
Messages: 11
Registered: November 2013
Junior Member
B = Finite(A)

is what I wanted. Wow, that was extremely easy. Thanks a lot you two!

Oliver


On Monday, 18 November 2013 09:57:53 UTC+1, alx wrote:
> Le lundi 18 novembre 2013 08:51:09 UTC+1, Oliver Angelil a écrit :
>
>> I have an array:
>
>>
>
>>
>
>>
>
>> A =MAKE_ARRAY(4000, 120, 60, 3, /FLOAT, VALUE =!VALUES.F_NaN)
>
>>
>
>>
>
>>
>
>> It consists of numbers between 0 and 1 as well as NaN values. I want to make a binary array from this, such that when an element is NaN, it'll be 0 in the binary array, and when it is a number between 0 and 1, it'll be 1 in the binary array.
>
>>
>
>>
>
>>
>
>> Perhaps there is a quick solution which I have not found yet?
>
>>
>
>>
>
>>
>
>> Thanks in advance,
>
>>
>
>>
>
>>
>
>> Oliver
>
>
>
> This is the purpose of the FINITE function. From IDL documentation:
>
>
>
> "Returns 1 (True) if its argument is finite. If the argument is infinite or not a defined number (NaN), the FINITE function returns 0 (False). The result is a byte expression of the same structure as the argument X."
>
>
>
> Then, you can simply write:
>
> IDL> A =MAKE_ARRAY(4000, 120, 60, 3, /FLOAT, VALUE =!VALUES.F_NaN)
>
> ... populate A ...
>
> IDL> B = Finite(A)
>
> use B ...
>
>
>
> alx.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: reading in from multiple files, performing operations and printing them to multiple output file
Next Topic: How to access properties of multiple plots in a function graphics window?

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

Current Time: Sat Oct 11 11:44:50 PDT 2025

Total time taken to generate the page: 1.92322 seconds