Sorry for missing explanation, code is for computing log differences for every two values of every column of matrix x. In vector y are dates for constrain that combinations must lie only within one day.
data looks like this:
Elbarto, I don't understand your code so much now, have to read help to implement it, but that "datenum" function from your another advice solved my first problem, so hope you are right again
Date(vector y)| Value(matrix x)
1.1.2000| 1, 2
1.1.2000| 2, 3
1.1.2000| 5, 4
1.1.2009| 3, 5
2.1.2009| 8, 6
2.1.2009| 4, 7
If I use for example data such
Originally Posted by CaptainBlack
to matrix z will be stored every outcome for loops "l" and "k" (in this case, b=1) in diagonal places as you wrote(1OU->1. outcome, 2OU->second, 3OU->third)
I used this way because i need to store answer for every value of loop "l" and corresponding values of "k" and in this way, so for reasons that I can't make it store the value in first zero position in vector I have to use matrix way, I can use matrix z(l+1,k) instead, but for z(i,j) I easy know where the value is in matrix z and can distinguish zeros from answer from these matlab put to empty places in the matrix. Maybe there is some way to write to first zero position in vector and I can use it instead of that matrix, but I don't know how to do it.
1OU, 0, 0
0, 2OU, 0
0, 0, 3OU
Can compute dimensions for "z" before, thanks for tip, but as I assume, first need to compute all restrictions for dates and maybe create another dummy variable to can correctly compute combination number for every day and sum them to compute dimensions of z, so I am not sure that this will speed it up. But I will try.
Thanks for helping me out with this.
I solved the problem to write in last zero position in vector, shame on me that i did not see it before. I still tried to find some function for that but just set
But i would still like to make it faster if it's possible somehow.