MATLAB: How to convert a row vector into a matrix ??

Using this code : C=reshape(C,[10,10]); I am getting an error like this : Error using reshape To RESHAPE the number of elements must not change.
Error in content (line 48) C=reshape(C,[10,10]); Please help me….

Best Answer

If you use reshape.... C=reshape(C,[10,10]); The matrix C (row vector) must have 10*10 = 100 elements. Does your C have 100 elements? You can convert a array into matrix of order [m,n] provided m*n = numel(C) i.e the m*n should be equal to the number of elements in C.
Eg.
C = rand(100,1) ;
C = reshape(C,[10,10]) ;