Let's say I have a 100x100 matrix, I want to divide it into equal parts of 10x10.
The problem is that the input matrix can be of any size (but always mod 10).
I looked at the mat2cell
function but it does not seem to work for a dynamic number of parts.
Or am I missing something?
Given an array of n non-negative integers. Choose three indices i.e. (0 <= index_1 <= index_ 2<= index_3 <= n) from the array to make four subsets such that the term sum(0, index_1) – sum(index_1, index_2) + sum(index_2, index_3) – sum(index_3, n) is maximum possible.
For matrices, there is no such thing as division. You can add, subtract, and multiply matrices, but you cannot divide them.
In the similar way , if we have to divide two matrices together we must take the inverse of one matrix and multiply it with the other matrix . Complete answer: So if we have to divide two matrices together we must take the inverse of one matrix and multiply it with the other matrix .
You just have to tell mat2cell
exactly how you want the matrix divided up. If you're positive that it is always going to be a multiple of 10 in both directions, then it is (fairly) simple. Assuming that X
is the matrix that you want to divide, and you want the resulting cell array in Y
:
Y = mat2cell(X, repmat(10,[1 size(X,1)/10]), repmat(10,[1 size(X,2)/10]));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With