フィルターのクリア

How can I average blocks of samples according to the belonging to specific classes?

2 ビュー (過去 30 日間)
alessio tugnolo
alessio tugnolo 2021 年 12 月 21 日
回答済み: Srivardhan Gadila 2021 年 12 月 31 日
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 件のコメント
Matt J
Matt J 2021 年 12 月 21 日
What kind of Matlab variable do you use to define the block boundaries?
alessio tugnolo
alessio tugnolo 2021 年 12 月 23 日
I have a cell array where for each row I have the number of belonging of each sample for each class..

サインインしてコメントする。

回答 (1 件)

Srivardhan Gadila
Srivardhan Gadila 2021 年 12 月 31 日
You can get started by writing a for loop and using the mean function.
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.

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by