1
function image = VecToImage(vec,nRows,nCols)
b'% image = VecToImage(vec,[nRows,nCols])'
b'% Convert an image from vector to matrix format.'
b'% Image must be square for this to work properly.'
b'% Also see ImageToVec.'
b'% 8/13/94\t\tdhb\t\tAdded optional nRows,nCols arguments.'
b'% Figure out image size'
b'\tnRows = floor(sqrt(m));'
b'elseif (nRows*nCols ~= m)'
b"\terror('Passed image dimensions do not match vector size');"
b'% Reshape it into an image'
b'image = reshape(vec,nRows,nCols);'
b'\\ No newline at end of file'
1
function image = VecToImage(vec,nRows,nCols)
2
% image = VecToImage(vec,[nRows,nCols])
4
% Convert an image from vector to matrix format.
5
% Image must be square for this to work properly.
9
% 8/13/94 dhb Added optional nRows,nCols arguments.
11
% Figure out image size
15
nRows = floor(sqrt(m));
17
elseif (nRows*nCols ~= m)
18
error('Passed image dimensions do not match vector size');
21
% Reshape it into an image
22
image = reshape(vec,nRows,nCols);