If saving characters is a thing, then:
julia> a = rand(Bool,3,2)
3×2 Array{Bool,2}:
 false  false
  true  false
 false   true


julia> 1a
3×2 Array{Int64,2}:
 0  0
 1  0
 0  1



On Monday, October 17, 2016 at 2:08:44 PM UTC+3, Scott Jones wrote:
>
> Tim, do you know if there is any difference in performance between the two 
> methods?
>
> Note, Sujoy, the first method that Tim showed is only available on v0.5 
> and later (some of the nice stuff added to entice people to move off of 
> v0.4.x to v0.5.x ;-) )
>
> On Monday, October 17, 2016 at 5:48:20 AM UTC-4, Tim Holy wrote:
>>
>> julia> a = bitrand(3,5)
>> 3×5 BitArray{2}:
>>   true  false  false  true   true 
>>
>  false   true   true  true  false
>>   true   true   true  true   true
>>
>> julia> Int.(a)
>> 3×5 Array{Int64,2}:
>>  1  0  0  1  1
>>  0  1  1  1  0
>>  1  1  1  1  1
>>
>> julia> convert(Array{Int}, a)
>> 3×5 Array{Int64,2}:
>>  1  0  0  1  1
>>  0  1  1  1  0
>>  1  1  1  1  1
>>
>>
>> On Mon, Oct 17, 2016 at 2:55 AM, Sujoy Datta <guess...@gmail.com> wrote:
>>
>>>
>>>
>>> I am a new user of Julia. Please help me to convert a nxm BitArray to an 
>>> nxm IntegerArray.
>>> What I want is to print 1 for 'true' and 0 for 'false'.
>>> Thank you in advance.
>>>
>>
>>

Reply via email to