trying to find highest values in a time segment

1 visualización (últimos 30 días)
Dominik
Dominik el 11 de Dic. de 2022
Comentada: Dominik el 13 de Dic. de 2022
I have a excel sheet (size 950x8) from which i need to find highest/lowest values in time period (first column which is date) and one of the other columns . Let's say 'which 7 days had the highest values'. I think i need to do this through loop somehow, but not really sure how.
Any help would be appreciated.

Respuesta aceptada

Image Analyst
Image Analyst el 11 de Dic. de 2022
Use maxk
%data = readmatrix(filename);
%values = data(:, 3); % For example data you want to check is in column 3.
values = rand(1, 10) % Sample data
values = 1×10
0.9677 0.7763 0.9682 0.5586 0.7599 0.0597 0.7981 0.0562 0.6211 0.0802
[maxValues, indexesOfMaxes] = maxk(values, 7)
maxValues = 1×7
0.9682 0.9677 0.7981 0.7763 0.7599 0.6211 0.5586
indexesOfMaxes = 1×7
3 1 7 2 5 9 4
%maxDates = data(indexesOfMaxes, 1); % Get corresponding dates from column 1

Más respuestas (1)

Peter Perkins
Peter Perkins el 12 de Dic. de 2022
It's not clear to me that Image Analyst's solution answers your question, mostly because your question is not very clear. If the question is, "what are the seven days that individually had the seven largest values?", then that seems like one solution. If you have dates and values, you are better off reading into a timetable and then just sorting by the variable of interest, but either would work.
But if the question is, "which seven day period had the largest values?", then you should create a timetable and use retime to aggregate to weeks, using something like @max as your aggregation method.
  1 comentario
Dominik
Dominik el 13 de Dic. de 2022
Image analyst's answer was, lest's say good enough. I'm new to matlab and it's usually enough for me to see how to start, I can get it somehow to work after that. So yeah, i'm thankful for any advice. Also thanks for that ''which seven day period had the largest values" , I was wondering how to do it (didn't need it in this case but hey good to know).

Iniciar sesión para comentar.

Categorías

Más información sobre Calendar 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