How can I average blocks of samples according to the belonging to specific classes?
조회 수: 2 (최근 30일)
이전 댓글 표시
I have a 2D matrix with samples collected at different times.
I don't have the same number of samples for each sampling time.
How can I average blocks of samples according to the belonging to specific sampling time?
댓글 수: 2
답변 (1개)
Srivardhan Gadila
2021년 12월 31일
Based on the above information, the following example might help you:
%% Generate random data
% size of cell array
N = 10;
data = cell(N,1);
for i=1:N
% Random size arrays within each row of cell array
n = randi(6,1);
data{i} = randn(n,1);
end
%% Compute mean
meanArray = zeros(N,1);
for i=1:N
meanArray(i) = mean(data{i});
end
You can also check the MATLAB Onramp course through which you can learn the essentials of MATLAB through this free, two-hour introductory tutorial on commonly used features and workflows.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!