Matrix of matrices in matlab

238 Views Asked by At

I need to build up the matrix of matrices. Say, for all $1\leq i,j\leq n$ I have to define a matrix $p_{ij}$ which will be a matrix $n\times n$. What I can do - it is to build up a matrix $P$ which is $n^2\times n^2$ - but for $n=20$ there is an error about memory.

Could you please tell me how to solve this problem?

2

There are 2 best solutions below

0
On BEST ANSWER

This sounds like a question you might be better off asking on stackoverflow.com.

0
On

I think you can use cell array

b=rand(20,20);  
c=rand(20,20);
a=cell(20);    %Construct cell array
a{1,1}=b;
a{1,2}=c;
...