[英]Create a 3d array consisting of vectors
Here is a very quick one which should be simple to answer if I can explain myself adequately. 如果我能充分解释自己,这是一个非常简单的回答。
I want to create a 144 x 96 x 10000 array called A such that 我想创建一个称为A的144 x 96 x 10000数组,这样
A(1,1,:) = 0.001 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009 0.010....10000 etc.
....
A(144,96,:) = 0.001 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009 0.010....10000 etc.
I assume I should use a combination of ones and repmat but I cant seem to figure this one out. 我认为我应该结合使用repmat和repmat,但是我似乎无法弄清楚这一点。
Thanks. 谢谢。
Permute will kill you on large arrays,... you can also try: 置换会杀死您的大型阵列,...您也可以尝试:
array= 0.001:0.001:1000;
A = repmat(reshape(array,1,1,numel(array)),[144 96 1]);
you could do it the following way: 您可以通过以下方式进行操作:
array=0.001:0.001:1000;
M=permute(repmat(array,144,1,96),[1 3 2])
It looks like repmat
doesn't like [144,96,1]
so we will create it in other size and then just change the order of the dimensions with permute
看起来repmat
不喜欢[144,96,1]
因此我们将其创建为其他尺寸,然后使用permute
更改尺寸顺序
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.