Just a simple nesting question:
I've got a <100x100 double>
matrix mat_B
, with I cumsum
. From the resulting matrix mat_A
, I just need the last row vec_C
, which I need to cumsum
again. My code looks like this:
mat_A = cumsum(mat_B);
vec_C = cumsum(mat_A(end,:));
My question is, if it's possible to put all of this inside one line of code. I know that cumsum(mat_B)
returns a matrix, but if I put (end, :)
behind the expression, it won't work.
I know it sounds quite silly, but I'd like to know how nesting works in those kind of situations.