Lets say – I have the two vectors:
a numbers=[14 14 2 25 25 14 14 14 2 23 23 23]:
b frequency_of_the_numbers_above=[2 1 2 3 1 3];
c new_numbers=[14 14 14 14 14 2 2 2 2 25 25 25 25 25 25 25 14 14 14 14 14 2 2 2 2 23 23 23 23 ];
b describes how often a value in vector a appears.For example:number 14 two times, that’s why first number in b is 2 ,number 2 in vector a one time that’s why second number in vector b is 1 etc.
what I now want is to adapt the vector b to vector c so that the result should look like:
new_numbers[14 14 14 14 14 2 2 2 2 25 25 25 25 25 25 25 14 14 14 14 14 2 2 2 2 23 23 23 23 ];
frequency_numbers_for_new_numbers=[2 2 2 2 1 1 1 1 2 2 2 2 2 2 2 3 3 3 3 3 1 1 1 1 3 3 3 3];
your question doesn’t seem to fit what’s in the vectors you posted. What b seems to be is how many of a given number appears in a in a ROW. As there are 5 14s in a. And your result seems to be whatever number was in b repeated for the number of that element in c is that what you want? Does a and c always contain the same numbers in the same order?
Well I’ll write the code to do what I described (in java)