Given the data of two columns below with negative and positive label
'0,Negative' '1,Negative' '1,Positive' '2,Negative' '2,Positive' '3,Positive' '4,Negative' '4,Positive' '5,Positive' '9,Positive'
Please I want to use the code below to sort for negative or positive numbers instead of even and odd numeric data example code below
for col = 1:size(croppedz, 2) %sort even/odd rows, reshape each into a Kx? matrix, sum across rows and divide the two sums
% K = can be anynumber that groups it
result(:, col) = sum(reshape(sort(croppedz(1:2:end, col)), K, []), 1) ./ sum(reshape(sort(croppedz(2:2:end, col)), K, []), 1); end end
Thanks for your help in advance
Tino
Best Answer