poster
2019-12-14, 20:13
我需要建立矩阵矩阵。说,对于所有$1\leq i,j\leq n$我必须定义一个矩阵$p_{ij}$ ,它将是一个矩阵$n\times n$ 。我所能做的-是建立一个矩阵$P$ ,它是$n^2\times n^2$ -但是对于$n=20$ ,则存在内存错误。
你能告诉我如何解决这个问题吗?
回答:
使用单元格 (http://www.mathworks.com/help/techdoc/ref/cell.html)数组。像这样
c = cell(3,3) %Create cell array of size *3x3* c = [] [] [] [] [] [] [] [] [] c{1,1}; = rand(3,3); %Set cell {1,1} to be random matrix of size *3x3* c{1,2} = ones(4,6) %Set cell {1,2} to be matrix of ones size *4x6* c = [3x3 double] [4x6 double] [] [] [] [] [] [] [] 等等..
更多&回答... (https://stackoverflow.com/questions/5243507)
你能告诉我如何解决这个问题吗?
回答:
使用单元格 (http://www.mathworks.com/help/techdoc/ref/cell.html)数组。像这样
c = cell(3,3) %Create cell array of size *3x3* c = [] [] [] [] [] [] [] [] [] c{1,1}; = rand(3,3); %Set cell {1,1} to be random matrix of size *3x3* c{1,2} = ones(4,6) %Set cell {1,2} to be matrix of ones size *4x6* c = [3x3 double] [4x6 double] [] [] [] [] [] [] [] 等等..
更多&回答... (https://stackoverflow.com/questions/5243507)