MATLAB: How to convert a column vector into an image

Hello sir
I have an vector of size (258×1). Now I want to convert it into a square matrix (101×101) i.e. in 2D image in matlab.
Please help me.

Best Answer

nrow = 6; ncol = 6;
B = full( sparse(C(:,1), C(:,2), A, nrow, ncol) );
Or
nrow = 6; ncol = 6;
B = accumarray(C, A(:), [nrow ncol]);