How to do data process in matlab by output the largest value at a same time step
1 次查看(过去 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!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/321808/image.png)
0 个评论
采纳的回答
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 Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!