I have a dataset:
ds = BIN VALUE ID 10 5 1 10 6 2 11 3 2 11 7 1 11 4 1
Bins are unique. I need to find the ID with the maximum VALUE for each BIN. Example output in the above example:
MAX = BIN VALUE ID 10 6 2 11 7 1
This was my attempt to loop through the data producing output where each column is a BIN and the row contain the VALUES. I was then going to find the maximum of each bin (column) but the values didn't sort right.
bin = unique(ds(:,1));val = ds(:,2);b=numel(bin);a=cell(b,1);for i=1:b a{i}=ds(ds(:,1)==idate(i),2:3); for j=1:length(a{i}) output(j,i)=(a{i}(j)); endend
I'm probably over complicating this. I have Matlab 2011. Thanks in advance for your time!
Best Answer