size

  • sz = size(A) returns a row vector whose elements are the lengths of the corresponding dimensions of A
    • For example, if A is a 3-by-4 matrix, then size(A) = [3 4]
    • For an empty array, vector, or scalar, size still returns a two-element vector
    • If A is a table or timetable, size(A) returns a two-element row vector consisting of the number of rows and the number of table variables !tocheck
  • szdim = size(A,dim) returns the length of dimension dim when dim is a positive integer scalar
  • szdim = size(A,[dim1,dim2,…,dimN]) returns the lengths of dimensions dim1, dim2, …, dimN as a row vector szdim
    • The brackets [] may be omitted
  • [sz1,...,szN] = size(__)
    • The argument may take any of the three forms above
      • For the second and third forms, the number of outputs on the LHS must match the number of dimensions queried
      • For the first form, when A has more than N dimensions, szN is the product of the lengths of the remaining dimensions
    • Behaves like Python Sequence Unpacking