I have two matrices a = m x 5 and b =m x 5 (m is large, say 1,000) which are already sorted as below:
How to generate a new matrix c = m x 5 which consists:
Column 1: exact replica of Column 1 of matrix a.
Column 2: Depends on non-zero elements of b as shown
so that it is adjusted by it's left hand side row of a - b + present row.
Zeros are not evaluated.
(example: 3.7107 - 2.96856 + 23.2988 = 24.0409 )
Columns 3 4 and 5, not sure yet so maybe start off with a SparseArray of m x 5? But most likely to be an extension of Column 2. i.e. Column 3,4 and 5 will be also adjusted once I have worked out how they need to adjusted by.
EDITED 31/12/2012 03:25am UK time:
Solution from @halirutan is partially correct because my input matrix a:
and matrix b:
gives matrix c:
Not sure how to do conditional check for column b to be non-zero before evaluating?