필터 지우기
필터 지우기

Sorting maximum value array by same date and time

조회 수: 2 (최근 30일)
SOMNATH MAHATO
SOMNATH MAHATO 2020년 5월 28일
편집: madhan ravi 2020년 5월 28일
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

답변 (1개)

Ameer Hamza
Ameer Hamza 2020년 5월 28일
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
Ameer Hamza
Ameer Hamza 2020년 5월 28일
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 2020년 5월 28일
can you suggest, how i would change my data type?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by