How to do data process in matlab by output the largest value at a same time step

3 ビュー (過去 30 日間)
Hi, I have a group of data which at each same time point, there are a few output values, I just would like output the largest value (X) at each specific time and draw a graph from the data points, for example, for time step 0.790001, I would like output X= 86.60254, for time 0.8, output X= 138.564. could someone let me know how to write a script to achieve this? Thanks!

採用された回答

Jayaram Theegala
Jayaram Theegala 2020 年 6 月 26 日
You can find the unique values of the 'Time' column which you can use to form groups. Then you can simply use the max function to find the maximum value of each groups.
Following code can help you get started:
a = [1,2,2,3,3,3,4,4,4];
b = [2,2,5,4,4,5,6,7,8];
u = unique(a);
out = arrayfun(@(x)max(b(a==x)), u);
If the table is very large and not fitting in the memroy. You can certainly do this iteratively using a for loop. Hope this helps.

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by