size

Matlab Functions List


  • 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]
    • 对于 empty array, vector 或 scalar, 函数仍返回两个元素的 vector
    • If A is a table or timetable, then 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 in the row vector szdim
    • 方括号 [] 可省略
  • [sz1,...,szN] = size(__)
    • 括号内可填上面三种形式
      • 填第 2, 3 种形式时, 前后元素数目必须一致
      • 填第 1 种形式时, 若 A 维数大于 N, 则 szN 为剩余维数长度之积
    • 类似于 Python Sequence Unpacking