MATLAB: How Can I replicate matrix in a loop

for loopmatrix

Here is a code in which I tried to replicate(create) x(jj)'s which contains numbers from 1 to 26 each contain one value and what I want to get is 20x40 matrix for each of 26 values of x's
Here is the code
m=20 n=40
for jj=1:length(x);
B(jj) = x(jj).*.001;%
B(:,:,jj) = B(ones(m,n));
end
but this code gives 20×40 for the first value of x only . please help me with this …thanks in advance

Best Answer

x=0.1:0.1:0.9
B=repmat(reshape(x,1,1,length(x)),20,40)