Finding mean of data in array inside another array
조회 수: 1 (최근 30일)
이전 댓글 표시
I copied data into a new variable called X, inwhich inside X there are 1851x1 array. Inside each array there are several number of data of array inside all 1851x1 array. How can I find the mean of each 1851 data. Thanks very much
댓글 수: 0
채택된 답변
Image Analyst
2023년 12월 12일
Did you try the obvious brute force for loop method:
theMeans = zeros(numel(X), 1);
for k = 1 : numel(X)
% Get the mean of the 1851 element double vector that is
% inside the kth cell of the X cell array.
theMeans(k) = mean(X{k});
end
추가 답변 (1개)
Jalal Khan
2023년 12월 12일
cellfun(@mean,--) applies the mean function to each cell of the cell array and returns a numeric array containing the mean for each cell.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!