>From the help for `cat`:
cat(dims, A...)

  Concatenate the input arrays along the specified dimensions in the 
iterable dims....

And indeed, if 
    size(M1)=(3,3,3) 
and 
    size(M2)=(3,3)
Then,
    size(cat(3,M1,M2)) = (3,3,4)

This method may not be efficient (though in terms of memory layout it could 
be).

On Saturday, February 13, 2016 at 1:06:02 PM UTC+2, Mauro wrote:
>
> I think this is not possible.  Instead use a Vector, append! to that and 
> then reshape in the end.  The reshape should result in a view and not a 
> copy, thus will be fast. 
>
> Mauro 
>
> On Sat, 2016-02-13 at 10:51, Vishnu Raj <[email protected] 
> <javascript:>> wrote: 
> > Hi, 
> > 
> > I have a three dimensional array (say 'z' ) like this : 
> > 
> > julia> z 
> > 4x3x3 Array{Int64,3}: 
> > [:, :, 1] = 
> >  1  5   9 
> >  2  6  10 
> >  3  7  11 
> >  4  8  12 
> > 
> > [:, :, 2] = 
> >  13  17  21 
> >  14  18  22 
> >  15  19  23 
> >  16  20  24 
> > 
> > [:, :, 3] = 
> >  25  29  33 
> >  26  30  34 
> >  27  31  35 
> >  28  32  36 
> > 
> > Now I have a matrix 'z1' as 
> > julia> z1 
> > 4x3 Array{Int64,2}: 
> >  37  41  45 
> >  38  42  46 
> >  39  43  47 
> >  40  44  48 
> > 
> > I want to put z1 at the end of third dimension of 'z'. So that the 
> output 
> > will be like 
> > julia> z[*:,:,4*] 
> > 4x3 Array{Int64,2}: 
> >  37  41  45 
> >  38  42  46 
> >  39  43  47 
> >  40  44  48 
> > 
> > I tried push!() and append!(), both gives me errors. 
> > 
> > Kindly suggest a way to do this. I want 'z' to grow in third dimension 
> as 
> > simulation progresses. 
>

Reply via email to