You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: V2Matrix.m
    path of file: ./repos/xolotl/+xtools
    
    the code of the file until where you have to start completion: %
%
% ;;     ;; ;;;;;;;;  ;;;;;;;   ;;;;;;;  ;;        ;;;;;;
%  ;;   ;;     ;;    ;;     ;; ;;     ;; ;;       ;;    ;;
%   ;; ;;      ;;    ;;     ;; ;;     ;; ;;       ;;
%    ;;;       ;;    ;;     ;; ;;     ;; ;;        ;;;;;;
%   ;; ;;
    
function [M, V_lim, dV_lim] = V2Matrix(V, V_lim, dV_lim)

corelib.assert(isvector(V),'V has to be a vector')

V = V(:);
dV = [NaN; diff(V)];

if nargin == 1
	% return V_lim and dV_lim too

	% compute V_lim
	V_lim = [min(V) - 5; max(V) + 5];

	% dV_lim
	temp = (nanmax(dV) - nanmin(dV))*.1;
	dV_lim = [min(dV) - temp, max(dV) + temp];

end