Sorting maximum value array by same date and time

1 visualización (últimos 30 días)
SOMNATH MAHATO
SOMNATH MAHATO el 28 de Mayo de 2020
Editada: madhan ravi el 28 de Mayo de 2020
I have an array of very large size 708273*3,the first and second column representing time and date respectively. Each time and date have many values. I need to find out maximum value from that. I have no idea with how to short those value from excel. Sample data file name "test1".
Any help will be highly appreciated.
With best regards,
Somnath

Respuestas (1)

Ameer Hamza
Ameer Hamza el 28 de Mayo de 2020
Try this
T = readtable('test1.xlsx');
grps = findgroups(T.Time, T.Date);
max_vals = splitapply(@max, T.Value, grps);
T.MaximumValue = max_vals(grps);
writetable(T(:,'MaximumValue'), 'test1.xlsx', 'Range', 'D1')
  24 comentarios
Ameer Hamza
Ameer Hamza el 28 de Mayo de 2020
Yes, it seems possible, but the first column of the excel file is in some custom format, which is not recognized by MATLAB. You may first need to change the data type of the first column in Excel and then follow the code in my comment to only save each maximum value once.
SOMNATH MAHATO
SOMNATH MAHATO el 28 de Mayo de 2020
can you suggest, how i would change my data type?

Iniciar sesión para comentar.

Categorías

Más información sobre Dates and Time en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by