Determine if all inputs are the same size in all dimensions.

283 descargas

Actualizado 14 May 2012

Ver licencia

samesize: takes any number of arrays of any type and returns true if
the dimensions of all the objects are the same


result = samesize(A, B, ...)


A, B etc are arrays or matrices of any type. samesize returns true if
they are all the same size in every dimension, and have the same number
of dimensions, or false otherwise

samesize returns true for zero arguments, or a single argument on the
basis that the input will definately be the same size as itself in these


astruct = struct('a',{1,2,3}); % creates a (1 x 3) struct array
anarray = [1,2,3];
acellarray = {2+6j, [1,2,3,4,5,6,7,8], 'a string'};
samesize(astruct, anarray, acellarray)

ans =

samesize(astruct, anarray', acellarray)

ans =

See also: size, ndims

Tested in R2008a and R2011a

Citar como

Richard Crozier (2023). samesize (, MATLAB Central File Exchange. Recuperado .

Compatibilidad con la versión de MATLAB
Se creó con R2008a
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS Linux
Más información sobre Shifting and Sorting Matrices en Help Center y MATLAB Answers.

Inspiración para: regexprepfile, strrepfile, refactor_fcn_name

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Versión Publicado Notas de la versión

removed first test for number of dimensions.

used any(diff(numdims)) suggestion from commenter