Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to divide a matrix into equals parts?

Tags:

matrix

matlab

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?

like image 287
Hubert Perron Avatar asked Nov 29 '09 23:11

Hubert Perron


People also ask

How do you divide a matrix into 4 parts?

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.

Can you split a matrix?

For matrices, there is no such thing as division. You can add, subtract, and multiply matrices, but you cannot divide them.

How do you divide two matrices?

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 .


1 Answers

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]));

like image 127
Donnie Avatar answered Oct 19 '22 14:10

Donnie