swapbytes C-mex function

버전 1.1.0.0 (7.46 KB) 작성자: James Tursa
swapbytes(X1,X2,...) reverses byte ordering of each element, little-endian values to/from big-endian
다운로드 수: 1.5K
업데이트 날짜: 2009/8/5

라이선스 보기

swapbytes is a self-building C-mex function that mimics the MATLAB intrinsic function of the same name, reversing the byte ordering of each element in array X1, X2, ..., converting little-endian values to big-endian (and vice versa). Mainly intended for those users with older version of MATLAB that do not have this intrinsic function available, but there are extensions that may be of interest to other users as well:

1) For structures and cell arrays, each component or cell is individually converted. Other classes (e.g., vpa, function handles, etc.) are not converted; a deep copy is returned instead.

2) swapbytes takes any number of input arguments; there must be the same number of matching output arguments (except in the special case of one input argument and no output arguments, in which case the answer is returned in ans).

3) swapbytes will convert the complex portion of variables as well as the real portion.

4) swapbytes works with sparse matrices.

For users with later versions of MATLAB, this mex file will clash with the actual intrinsic of the same name. If you want to use this mex file and still have access to the MATLAB intrinsic, simply rename this file and the help file to something unique, like swapbytesx.c and swapbytesx.m

swapbytes runs up to 3x faster than the MATLAB intrinsic swapbytes for some versions of MATLAB.

Note that swapbytes is a self-building C-mex function ... you don't have to know anything about C to build or use it.

인용 양식

James Tursa (2024). swapbytes C-mex function (https://www.mathworks.com/matlabcentral/fileexchange/17661-swapbytes-c-mex-function), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2006a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Write C Functions Callable from MATLAB (MEX Files)에 대해 자세히 알아보기

Community Treasure Hunt

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

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

Added sparse matrix support, and BSD license.

1.0.0.0