groupMeans

버전 1.0.0.0 (1.8 KB) 작성자: Sanjay Manohar
MEAN(X,DIM,CATEG) - take the MEAN of X along DIM, but grouped according to a categorical variable.
다운로드 수: 239
업데이트 날짜: 2013/2/11

라이선스 보기

mu = groupMeans( X, DIM, CATEG )

MEAN of the matrix X along dimension specified, but grouping the other dimensions according to the categories in 'categ'.

CATEG must threfore have same length as the specified dimension of X.

returns: a matrix with same size as X, except for the specified dimension -- along that dimension, there is one slice per unique level of 'categ'.

% example:
% X = [1 2 3; 4 5 6; 7 8 9; 10 11 12]
% C = [ 1; 1; 2; 2 ]; % each row of X has a category
% groupMeans( X, 1 ,C ); % mean along vertical dimension, but group
% % rows according to C
% ans =
% 2.5 3.5 4.5
% 8.5 9.5 10.5
%
% i.e. the first row is mean( X( C==1, : ) , 1 )
% and the second row is mean( X( C==2, : ) , 1 )
%

note: the function will use NANMEAN if you have it on the path.

인용 양식

Sanjay Manohar (2024). groupMeans (https://www.mathworks.com/matlabcentral/fileexchange/40234-groupmeans), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2012b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
태그 태그 추가

Community Treasure Hunt

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

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