Reputation: 781
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(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.
Thanks.
Upvotes: 0
Views: 40
Reputation: 1475
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]);
Upvotes: 2
Reputation: 35525
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
Upvotes: 1