How to do data process in matlab by output the largest value at a same time step
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
chen ling
am 25 Jun. 2020
Kommentiert: chen ling
am 26 Jun. 2020
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!
0 Kommentare
Akzeptierte Antwort
Jayaram Theegala
am 26 Jun. 2020
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.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!