I have two arrays:
OTPCORorder = [61,62,62,62,62,62,62,62,62,62,62,62,65,65,...] AprefCOR = [1,3,1,1,1,1,1,1,1,1,2,3,3,2,...]
for each element in OTPCORorder there is a corresponding element in AprefCOR. I want to know the percentage of the number 1 for each unique OTPCORorder set as follows:
OTPCORorder1 = [61,62,65,...] AprefCOR1 = [1,0.72,0,...]
I already have this:
[OTPCORorder1,~,idx] = unique(OTPCORorder,'stable'); ANS = OTPCORorder1 = [61,62,65,...];
and I worked with the βdriveβ, but I used the mean or sum function, such as:
AprefCOR1 = accumarray(idx,AprefCOR,[],@mean).';
I am just wondering if there is a way to use this, but with the function "prctile" or any other function that gives me the percentage of a particular element, like "1" in this case.
Thank you very much.