title: Convert float 2-D array to integer 2-D array in Julia
body: <p>I know that it is possible to convert a <code>Float64</code> into an <code>Int64</code>
  using the <code>convert</code> function.
  Unfortunately, it doesn't work when applying <code>convert</code> to a 2-D array.</p>
  
  <pre><code>julia&gt; convert(Int64, 2.0)
  2
  
  julia&gt; A = [1.0 2.0; 3.0 4.0]
  2x2 Array{Float64,2}:
   1.0  2.0
   3.0  4.0
  
  julia&gt; convert(Int64, A)
  ERROR: `convert` has no method matching convert(::Type{Int64}, ::Array{Float64,2
  })
   in convert at base.jl:13
  </code></pre>
  
  <p>How do I convert a 2-D array of floats into a 2-D array of ints?</p>
  
  <h3>What I tried</h3>
  
  <p>I could do it using the following code,
  which is a little verbose but it works.
  I am hoping there is an easier way to do it though.</p>
  
  <pre><code>julia&gt; A = [1.0 2.0; 3.0 4.0]
  2x2 Array{Float64,2}:
   1.0  2.0
   3.0  4.0
  
  julia&gt; B = Array(Int64, 2, 2)
  2x2 Array{Int64,2}:
   4596199964293150115  4592706631984861405
   4604419156384151675                    0
  
  julia&gt; for i = 1:2
             for j = 1:2
                 B[i,j] = convert(Int64,A[i,j])
             end
         end
  
  julia&gt; B
  2x2 Array{Int64,2}:
   1  2
   3  4
  </code></pre>
  
  <h3>An answer that doesn't work for me</h3>
  
  <pre><code>               _
     _       _ _(_)_     |  A fresh approach to technical computing
    (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
     _ _   _| |_  __ _   |  Type "help()" for help.
    | | | | | | |/ _` |  |
    | | |_| | | | (_| |  |  Version 0.3.10 (2015-06-24 13:54 UTC)
   _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org release
  |__/                   |  x86_64-linux-gnu
  
  julia&gt; A = [1.2 3.4; 5.6 7.8]
  2x2 Array{Float64,2}:
   1.2  3.4
   5.6  7.8
  
  julia&gt; round(Int64, A)
  ERROR: `round` has no method matching round(::Type{Int64}, ::Array{Float64,2})
  </code></pre>