Skip to main content

5.4) Joining And Reshaping Arrays


  • cat - concatenate (join) vectors and matrices (A1,A2,...) along a specified dimension (dim). The syntax is cat(dim,A1,A2,...)
  • [matlab]
    >> a=rand(3,3);
    >> b=ones(3,3)*pi;
    >> c=cat(3,a,b)
    [/matlab]

    So that "c" now has dimensions 3x3x2.

  • reshape = change dimensions of a vector or matrix