Find corresponding values of discritized data after using splitapply

3 ビュー (過去 30 日間)
Tessa Kol
Tessa Kol 2020 年 8 月 24 日
コメント済み: Tessa Kol 2020 年 8 月 24 日
I have a 3384x5 array of which the first and last 20 rows are shown in the pictures below.
With the help of Cris LaPierre I was able to discretize my data (https://nl.mathworks.com/matlabcentral/answers/583103-find-maximum-value-of-array-within-specified-range-consecutively?s_tid=prof_contriblnk)
I wanted to do a similar process as in the mentioned in the link.
Code so far:
% % Define edges of ranges
rng_x = -0.06:0.011:0.061;
% Assign the data of column 1 to a predefined range
disc_x = discretize(x,rng_x);
% Group the data of column 1
slice_x = splitapply(@(x) {x},x,disc_x);
As can be seen in the figure below the splitapply did what I intented it to be, it grouped the data of column 1 in each defined range. Thus:
Every value of column 1 lying between -0.06 and -0.049 is grouped into the first cell (269x1 double)
Every value of column 1 lying between -0.049 and -0.038 is grouped into the second cell (340x1 double)
And so on...
Problem: How can I retrieve the values of the 2nd column and 3th that correspond to the grouped data of column 1?

採用された回答

Bruno Luong
Bruno Luong 2020 年 8 月 24 日
編集済み: Bruno Luong 2020 年 8 月 24 日
if x is extracted as the first column of your array A
slice_x = splitapply(@(x) {x}, A, disc_x);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Distribution Plots についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by