How to extract the unique value from column 1, with the highest corresponding value from column 2 and the adjacent time value from column 3?
Show older comments
Hi,
In the attached file, column 1 have head values in which each number have a repetition, for example 0,0,0, few times then 1,1,1,1 few times but in the adjacent column flowrate values are different fro each head value. I am looking to extract the head value with the highest corresponding flowrate value and the adjacent time. I am googling and not been able to find anything so far I would appreciate your help. I know how to do it in excel using unique, index and match function but since I have alot of files matlab script will help alot.
Thanks in advance for help
1 Comment
Rik
on 23 Dec 2022
This is probably not too difficult to implement with a loop. What have you tried so far? Which part are you stuck? Do you know how to import your data to a Matlab variable? What code did you attempt to write to get to your desired result?
Accepted Answer
More Answers (1)
I am not seeing that in column 1. I see
fileName = 'SCURVE.xlsx';
data = readtable(fileName);
head(data)
Where are the runs of 0's, then 1's, etc.? Evidently not in column 1 like you say. Not even in column 2, the "Head" column. And the Head values are not just runs of integers like 0, 1, 2, 3, etc. They are fractional numbers, though some are repeated.
Anyway, I think you can probably use these functions: findgroups, splitapply, grpstats, or groupsummary
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!