How to select specific row in a matrix

1 回表示 (過去 30 日間)
AKHILESH KUMAR
AKHILESH KUMAR 2018 年 3 月 19 日
コメント済み: Akira Agata 2018 年 3 月 21 日
i have data like
doy time aod
5 05:46:46 0.62800
5 05:46:56 0.62100
5 05:47:07 0.61600
7 06:47:06 0.53600
7 06:47:16 0.53200
7 06:47:27 0.53500
11 08:31:35 0.64000
11 08:31:46 0.63400
11 08:31:57 0.62600
and i want this data like(for minimum aod in group)
5 05:47:07 0.61600
7 06:47:16 0.53200
11 08:31:57 0.62600
  2 件のコメント
James Tursa
James Tursa 2018 年 3 月 19 日
How do you currently have the data stored? In a table variable? Or ...?
AKHILESH KUMAR
AKHILESH KUMAR 2018 年 3 月 20 日
data are stored in table

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

回答 (1 件)

Akira Agata
Akira Agata 2018 年 3 月 20 日
Assuming your data is stored in table format, say T, the following code can do that.
func = @(x) T(T.aod == min(x),:);
Tout = splitapply(func,T.aod,findgroups(T.doy));
The result is like this:
>> Tout
Tout =
3×3 table
doy time aod
___ ________ _____
5 05:47:07 0.616
7 06:47:16 0.532
11 08:31:57 0.626
  3 件のコメント
AKHILESH KUMAR
AKHILESH KUMAR 2018 年 3 月 20 日
what is x and in MATLAB time, aod ,doy are string.
Akira Agata
Akira Agata 2018 年 3 月 21 日
x is an input variable of an 'anonymous function'. Please visit the following link for more details.

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

カテゴリ

Help Center および File ExchangeTables についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by