Julia has repmat. You can look up its methods like this:

julia> methods(repmat)
# 3 methods for generic function "repmat":
repmat(a::AbstractArray{T,1},m::Int64) at abstractarray.jl:964
repmat(a::Union(AbstractArray{T,2},AbstractArray{T,1}),m::Int64) at 
abstractarray.jl:950
repmat(a::Union(AbstractArray{T,2},AbstractArray{T,1}),m::Int64,n::Int64) 
at abstractarray.jl:950

>From these signatures, you can read off that Julia expects integers as the 
trailing arguments, not an array. The third signature is the one we're 
looking for.

julia> A = rand(3, 3)
3x3 Array{Float64,2}:
 0.595856  0.413262   0.652419
 0.111673  0.709227   0.16245
 0.577607  0.0896444  0.943816

julia> B = repmat(A, 1, 4)
3x12 Array{Float64,2}:
 0.595856  0.413262   0.652419  0.595856  …  0.595856  0.413262   0.652419
 0.111673  0.709227   0.16245   0.111673     0.111673  0.709227   0.16245
 0.577607  0.0896444  0.943816  0.577607     0.577607  0.0896444  0.943816

Alternatively, you can use the splat operator, "..."

julia> B = repmat(A, [1, 4]...)
3x12 Array{Float64,2}:
 0.595856  0.413262   0.652419  0.595856  …  0.595856  0.413262   0.652419
 0.111673  0.709227   0.16245   0.111673     0.111673  0.709227   0.16245
 0.577607  0.0896444  0.943816  0.577607     0.577607  0.0896444  0.943816

On Friday, May 16, 2014 11:18:14 AM UTC-7, paul analyst wrote:
>
> in matlab :
> x=[1,4]
> B=repmat(A,x)
>
> /(B==AAAA)
>
>
> how to replicate A in Julia
> Paul
>
>
>

Reply via email to