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

2 visualizaciones (últimos 30 días)
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!

Respuesta aceptada

Jayaram Theegala
Jayaram Theegala el 26 de Jun. de 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.

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by