CELL2FLOAT

버전 1.3.0.0 (2.26 KB) 작성자: Jos (10584)
converts cell array into scalar float array (v4.0, jan 2010)
다운로드 수: 3.4K
업데이트 날짜: 2010/1/4

라이선스 보기

CELL2FLOAT - converts cell array into scalar float array

M = CELL2FLOAT(C) returns a float array M with the same size as the cell array C. C can be any N-dimensional cell array. Cells of C that contain a scalar float (single or double) are put in corresponding locations of M. Cells that contain other datatypes (e.g., strings, arrays, empty, integers, etc.) yield NaNs in the corresponding locations of M.

M = CELL2FLOAT(C,F) uses the value F instead of NaN to fill these latter locations. F should be a scalar float (single or double).

M = CELL2FLOAT(C,F,'error') will cause the program to error if a cell does not contain a scalar float. If F is empty ([]), NaN will be used as the filler value.

[M,Q] = CELL2FLOAT(C, ..) returns a logical array Q with logical ones (true) where the values of C are floats, and logical zeros (false) elsewhere.

Examples:
C = {single(1) 2 'x' [] ; 1:3 complex(1,2) uint8(1) Inf}
M = cell2float(C)
% -> [ 1.00 2.00 NaN NaN ;
% NaN 1.00 + 2.00i NaN Inf ]

cell2float({1 2 [] 3 [] 5},999)
% -> [ 1 2 999 3 999 5 ]

cell2float({1,2,'x'},[],'error')
% ??? Error using ==> cell2float at 80
% Not all cells contain a scalar float.

See also cell2mat, cellfun, num2cell

version 4.0 jan 2010

인용 양식

Jos (10584) (2024). CELL2FLOAT (https://www.mathworks.com/matlabcentral/fileexchange/19730-cell2float), MATLAB Central File Exchange. 검색됨 .

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

받음: cell2num

줌: Pivot/unPivot

Community Treasure Hunt

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

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

fixed error noted by Oleg. Note that the syntax has changed.

1.2.0.0

updated description

1.1.0.0

incorporated the error suggestion by Oleg

1.0.0.0

spelling description