MATLAB: How to reshape a matrix from a vector

matrixmatrix manipulation

I have a vector of 105 elements where the sizes are not compatible for a matrix. I want to make it a 2 dimensional matrix by adding zeros at last so that it becomes compatible for the matrix. Would you please tell me how can i do it?

Best Answer

If, e.g., 200 is the desired size, just use
vec(200) = 0;
All values between 105 and 200 will be filled with zeros.
Related Question