trying to find highest values in a time segment
조회 수: 1 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
채택된 답변
Image Analyst
2022년 12월 11일
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
[maxValues, indexesOfMaxes] = maxk(values, 7)
%maxDates = data(indexesOfMaxes, 1); % Get corresponding dates from column 1
댓글 수: 0
추가 답변 (1개)
Peter Perkins
2022년 12월 12일
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.
참고 항목
카테고리
Help Center 및 File Exchange에서 Calendar에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!