Splitting up large arrays based on datetimes without using loops
古いコメントを表示
Hi, I've a large dataset consisting of 10min samples and an acompanying datetime array spanning many years on which I wish to perform certain functions on each month. Is there a way to operate on each individual month without using nested loops? I wish to calculate the skewdness and kurtosis every month for every column in the dataset and then store the results to run control charts on and update at a later date. Thanks in advance!
3 件のコメント
Jan
2017 年 9 月 20 日
What's wrong with nested loops? Without knowing, how the data are represented in your "dataset", it is hard to suggest some code for processing it. I'd expect findgroup and splitapply to solve this problem without creating explicit loops.
Kinz_boy
2017 年 9 月 20 日
Apparently you have a function kurtosis already. One way to debug calls to ACCUMARRAY (assuming that you already checked out that indices are fine) is to output a cell array of grouped values:
groups = accumarray(temp_subs, temp_vals,[], @(x){x});
so you can checkout what is passed to your aggregation function. If all groups are empty there is an issue with your IND and/or VAL inputs. If groups make sense, the issue is with your aggregation function.
採用された回答
その他の回答 (1 件)
Steven Lord
2017 年 9 月 20 日
0 投票
If you have your data stored in a timetable, use retime. Specify @skewness or @kurtosis as the aggregation method, assuming you have Statistics and Machine Learning Toolbox available. If you don't, you will need to write your own functions to compute those statistics and specify those as the aggregation method when you call retime.
カテゴリ
ヘルプ センター および File Exchange で Data Type Identification についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!