Calculating statistical functions for a structure array which each cell has a different size

2 ビュー (過去 30 日間)
Hi,
I have a structure array which is mentioned below.
59x1 double 38x1 double 39x1 double 25x1 double 16x1 double
Each cell in my array includes some data and the number of data for each cell varies from one to another. Indeed, I have provided a small piece of my array here. The original one has 1600 cells and each cell contains about 40-80 data.
I know how to calculate the Mean, Variance, Skewness, Kurtosis, Max, Min, Median and quantile (10-90) when I'm working with a matrix but I cannot do the same task for a structure array. I really need to calculate the mentioned mathematical functions for my array.
Please let me know what should I do.
I have been struggling with this issue for a week and still don't know what should I do.

採用された回答

Matt J
Matt J 2019 年 10 月 18 日
編集済み: Matt J 2019 年 10 月 18 日
A structure array doesn't have "cells" and doesn't look like that. I assume you really mean your data is a cell array, in which case, you can use cellfun, e.g.,
mean_of_cells = cellfun(@mean, myData)
  3 件のコメント
Matt J
Matt J 2019 年 10 月 18 日
Also, I cannot use this funtion for Min, Max, and Quantile.
Why not?
Actually, I want calculate the Mean of the whole array
Just concatenate all your cells into one array
array=vertcat(myData{:});
mean(array)
max(array)
etc...
Farbod Tavakkoli Khomeini
Farbod Tavakkoli Khomeini 2019 年 10 月 18 日
I appreciate it, you really solved my whole past few days problem.

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

その他の回答 (0 件)

カテゴリ

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