As the documentation of mat2cell explain, the dim inputs specify the size of each block along a particular dimension. The sum of the size of the blocks must equal the size of the matrix to be split in each dimension. So, with
sum(dim1) must equal size(A, 1) and sum(dim2) must equal size(A, 2).
You haven't properly explained what you're trying to do, so we can't really tell you what the solution is. One valid use of mat2cell with your input matrix would be:
mat2cell(BB, [3 2 1 2], [4 1 1])
since the first dim argument sums to 8 (creates blocks of height 3, 2, 1, and 2 respectively) which is the number of rows of BB, and the second dim sums to 6, the number of columns of BB.
Now, perhaps you want to split the matrix into 1x1 cells, in which case the proper function is num2cell not mat2cell:
Or you want to split it into a cell array of row vectors:
or column vectors