Pretend I have two cell arrays A and B, each element in those cells is N*M matrix, example :A={ [2 3;4 5] [1 5;7 8]}
and B={ [1 2;4 5] [7 9;10 1]}
both are cells each element is 2*2 matrix.
Now I can subtract those cell arrays element-wise like this:
C=cellfun(@minus,A,B,'UniformOutput',false);
this will result in C={[1 1;0 0] [-6 -4;-3 7]}
.
Now is that the fastest way ? or is there a faster approach ?
Consider cells with large number of matrices each matrix is small.
cell2mat
you could create a 3D-matrix, Calculations then are faster, but ascell2mat
andmat2cell
are slow, it really depends on your data size. – Robert Seifert