How to group arrays in a cell based from data?

2 ビュー (過去 30 日間)
Heirleking
Heirleking 2022 年 4 月 22 日
コメント済み: Heirleking 2022 年 5 月 10 日
I have this graph representing force vs. time. Then, I found its peaks to group them representing sort of a trend. I need to create two different cells, one for the forces with positive peaks and one for the negative ones, and two different cells of the location in the "x" axis (time) of the positive and negative peaks.
For example, for the negative peak forces, I was using histcounts.
pks_f_min = [ -68.0928; -63.6998; -110.9254; -103.2375; -132.8908; -125.2030; -137.2840; -113.1220; -148.2667; -144.9718; -151.5615; -159.2494; -151.5615 ]
[~,~,f_bins]=histcounts(pks_f_min, flip([0 -10 -20 -30 -40 -50 -60 -70 -80 -90 -100 -110 -120 -130 -140 -150 -160]));
u=unique(f_bins);
for k=1:numel(u)
groups_f_min{k}=pks_f_min(f_bins==u(k));
end
In the end, groups_f_min needs to look like this:
groups_f_min = { [ -68.0928; -63.6998 ] [-110.9254; -103.2375 ] [ -132.8908; -125.2030 ] [ -137.2840; -113.1220] [ -148.2667; -144.9718 ] [ -151.5615] [ -159.2494; -151.5615 ]}
Since I will be using this code for other graphs, is there a way to make it automatically?. For instance, other force patterns may need to be grouped in a cell consisting of two, three, or four arrays. For example, the array in the cell groups_f_min, which is alone (-151.5615), would be accompanied by another value
  6 件のコメント
Voss
Voss 2022 年 4 月 23 日
In that case, I guess the bins for grouping (in both the positive and negative peaks cases) should be based on the times when the load is applied.
Heirleking
Heirleking 2022 年 5 月 10 日
Do you mind explaining what do you mean by based on times ? Displacement peaks and force peaks do not occur at the same time

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeGraphics Object Programming についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by