Skip to content

size_equal

Test whether all inputs share the same shape.

tf = size_equal(a, b)
tf = size_equal(a, b, c, ...)

Returns scalar true when every argument has the same dimension vector. Trailing singleton dimensions are tolerated — size_equal(zeros(3,4), zeros(3,4,1)) returns true. With fewer than two arguments, returns true trivially.

size_equal(zeros(3,4), ones(3,4)) % 1
size_equal(zeros(3,4), ones(4,3)) % 0
size_equal([1 2 3], [4 5 6], [7 8 9]) % 1
  • size — Sizes along all dimensions, or along one specific dimension.
  • isequal — Test whether two or more inputs are equal in shape and value.