0

I'm trying to split a 1048x1190 matrix into smaller matrix using

C = mat2cell(I,[131 119],[131 119]);

I'm getting the error

Input arguments, D1 through D2, must sum to each dimension of the input matrix size, [1048 1190].

Would this not divide this into an 8 (1048/131) x 10 (1190/119) array?

coffeelover
  • 33
  • 1
  • 1
  • 6
  • This isn't a duplicate. I don't understand the function. – coffeelover Mar 07 '16 at 13:25
  • unfortunately it doesn't work that way. You have to specify the size of **each** row and column. So for the rows, since you want them all to be 131, you'd set the second input to [131,131,131,131,131,131,131,131] (8 131's). And the third input are the number of column in each sum element which for you would be an array of 10 119's [119,119,.... This is annoying sometimes but makes `mat2cell` more flexible. The easy way to create your inputs is using `repmat` or something, `C = mat2cell(I, repmat(131, [1 8]), repmat(119, [1 10]));`. – Suever Mar 07 '16 at 16:00

0 Answers0