bsxarg

버전 1.0.0.0 (4.9 KB) 작성자: James Tursa
bsxarg returns the physically expanded arrays associated with bsxfun
다운로드 수: 1.3K
업데이트 날짜: 2008/2/11

라이선스 없음

bsxarg returns the singleton expanded arrays that are virtually used in bsxfun. bsxarg is limited to a maximum of 12 dimensions. The MATLAB intrinsic function bsxfun performs binary operations on input arrays, where singleton dimensions are virtually expanded to perform the operation. bsxarg will actually do the singleton expansion and return the physically expanded arrays.

Building (one-time only):

>> mex -setup
(then follow instructions to select a C / C++ compiler of your choice)
>> mex bsxarg.c

Syntax

[C D] = bsxarg(A,B)

Description

C = the expanded version of A.
D = the expanded version of B.

Each dimension of A and B must either be equal to each other, or equal to 1. Whenever a dimension of A or B is singleton (equal to 1), the array is virtually replicated along the dimension to match the other array. The array may be diminished if the corresponding dimension of the other array is 0.

The size of the output arrays C and D are equal to:

max(size(A),size(B)).*(size(A)>0 & size(B)>0).

User's with older versions of MATLAB that do not have the MATLAB intrinsic bsxfun available to them can use this simple m-file to get that capability:

function C = bsxfun(fun,A,B)
if( nargin ~= 3 )
error('Need 3 arguments for bsxfun')
end
[AX BX] = bsxarg(A,B);
if( ischar(fun) )
C = eval([fun '(AX,BX)']);
else
C = fun(AX,BX);
end
return
end

인용 양식

James Tursa (2024). bsxarg (https://www.mathworks.com/matlabcentral/fileexchange/18686-bsxarg), MATLAB Central File Exchange. 검색됨 .

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

Community Treasure Hunt

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

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