Calculating statistical functions for a structure array which each cell has a different size
조회 수: 1 (최근 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.
댓글 수: 0
채택된 답변
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
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...
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!