MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   Matlab中的矩阵矩阵 (https://www.labfans.com/bbs/showthread.php?t=26543)

poster 2019-12-14 20:13

Matlab中的矩阵矩阵
 
我需要建立矩阵矩阵。说,对于所有$1\leq i,j\leq n$我必须定义一个矩阵$p_{ij}$ ,它将是一个矩阵$n\times n$ 。我所能做的-是建立一个矩阵$P$ ,它是$n^2\times n^2$ -但是对于$n=20$ ,则存在内存错误。

你能告诉我如何解决这个问题吗?



[B]回答:[/B]

使用[URL="http://www.mathworks.com/help/techdoc/ref/cell.html"]单元格[/URL]数组。像这样

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] [] [] [] [] [] [] [] 等等..



[url=https://stackoverflow.com/questions/5243507]更多&回答...[/url]


所有时间均为北京时间。现在的时间是 14:54

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.