samesize

버전 1.2.0.0 (1.55 KB) 작성자: Richard Crozier
Determine if all inputs are the same size in all dimensions.
다운로드 수: 283
업데이트 날짜: 2012/5/14

라이선스 보기

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

Syntax

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

Description

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
cases.

Example

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 =
1

samesize(astruct, anarray', acellarray)

>>
ans =
0

See also: size, ndims

Tested in R2008a and R2011a

인용 양식

Richard Crozier (2024). samesize (https://www.mathworks.com/matlabcentral/fileexchange/36636-samesize), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2008a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.2.0.0

removed first test for number of dimensions.

1.1.0.0

used any(diff(numdims)) suggestion from commenter

1.0.0.0