MATLAB: What is meaning of c(:,1) and . in matlab code

MATLABmatrix

I have code .What does it mean?
c(:,1)=0.5*ones(10,1); //What is c(:, 1)?
for i = 1:s
Delta(:,i)=(2*round(rand(2,1))-1).*rand(2,1); //What is .?
end
for m=1:s
P(1,:,1,1,1)= 50*rand(s,1)'; //What is ' and P(1, :, 1,1,1)?
P(2,:,1,1,1)= 0.2*rand(s,1)';
end

Best Answer

I agree with dpb: To use a powerful programming language like Matlab, you have to read the manuals. The forum is not the right location to explain the basics, because they are explained in the "Getting Started" chapters exhaustively already.
  • You will find out, that c(:,1) is the first column of the matrix "c", e.g. a column vector.
  • The operator is not "." but ".*", which means an elementwise multiplication. A * B is a matrix product, while A .* B multiplies the elements of the arrays.