Hey guys,
I wanted to build an algorithm which should be able to combine different options till a treshold F.
C = sort([4,1,10,6],2);[numRows,numCols] = size(C);F = 7;O= 1;
So now there should be a new matrix U that should look like this:
U(1) = 1 + 1*4; — the first one standts for the value one in C
U(2) = 1 + 2*4;
U(3) = 1 + 3*4; — now the treshold of 2*F is reached and it continues with the new number of C = 6
U(4) = 1+ 1*6;
U(5) = 1+2*6;
when all options with C = 1 are calculated the algorithm should continue with the next value of C. In this case 4
U(n) = 4+ 1*1;
U(n+1) = 4+ 2*1;
And so on.
I came up with this:
for i = 1:numCols while (O > 1) && (N(t) < 2*F) for t = 1:numCols N(t) = C(i) + 1 * C(i); O = O-1; end end end
Any idea how to solve this? This is driving me crazy
Best Answer