I have an 3D dimensional Array of data. It has this kind of strucuture: {i,x,y}
{{1, 1, 6}, {2, 2, 4}, {3, 3, 5}, {4, 4, 7}, {5, 5, 2}, {6, 6, 5}, {7,
8, 2}, {8, 9, 7}, {9, 10, 6}, {10, 13, 6}, {11, 14, 7}, {12, 15,
3}, {13, 16, 6}, {14, 18, 3}, {15, 21, 1}, {16, 22, 3}, {17, 23,
4}, {18, 24, 2}, {19, 26, 4}, {20, 28, 6}, {21, 29, 6}, {22, 31,
2}, {23, 33, 5}, {24, 34, 5}, {25, 35, 5}, {26, 36, 5}, {27, 38,
3}, {28, 40, 7}}
I want to change only the w column of the data in this way: Lets say we are at the i´th row: {i,v,w} and the next is the i+1 row: {i+1,y,z} The rule should be:
If v+w>=y then w->y - 1 - v Else nothing
And for the last row, where there isnt any y the y should be v1+n. The very first v1 plus some kind of a number. Meaning the last v->y1+n - 1 - v This is very confusing so I will give an example: Lets say the starting array is:
{{1,5,3},{2,7,4},{3,8,0},{4,10,3},{5,14,7}} n=15;
Then the resulting array would be:
{{1,5,1},{2,7,0},{3,8,0},{4,10,3},{5,14,5}}
And the second part of the problem would be only changing the v column:
v->v+w
BlockMap
. $\endgroup$MapAt
to handle the last element. "Also BlockMap unfortunately doesnt process "If" functions" I don't think so. How do you use it? $\endgroup$blax
,bla(x+1)
,blay
notation is just terrible, please improve it. $\endgroup$f[{{u_,v_,w_},{x_,y_,z_}}]
$\endgroup$