Matrix input:
input = [1 3 50 601 1 40 601 4 30 602 3 40 502 4 30 502 1 50 502 9 10 503 2 20 03 9 30 03 5 40 04 2 50 -204 2 60 -204 1 10 -204 1 25 -204 8 80 -20];% there are three 1, so 60/3, there are four 2, so 50/4, there are three 3, so 0/3 and there are five 4, so -20/5.
% 50-60/3 = 30
% 40-60/3 = 20
% 30-60/3 = 10
Based on the similar arrays in the first column, I want to find for example how many 1 are there. Then divide the forth column by that (for example 1 is 3 here) and then reduce the amount from the third column. The first output should be:
output1 = [1 3 301 1 201 4 102 3 27.52 4 17.52 1 37.52 9 -2.53 2 203 9 303 5 404 2 544 2 644 1 144 1 294 8 84];
For the second output, I want the same process, but instead of counting all same numbers in the first column, this time just look at the second column and count if there is 3 and 4 (for every unique number in the first column).
output2 = [1 3 201 1 401 4 02 3 152 4 52 1 502 9 103 2 203 9 303 5 404 2 504 2 604 1 104 1 254 8 80];% for "1", there are two 3&4, so 60/2
% 50-60/2 = 20
% 30-60/2 = 0
Best Answer