MATLAB: Name-Value Pairs error

MATLABnamename-value pairs;pairsvalue

I am trying to solve this question using "name_value_pairs" but it is accepting "wrong type for name", rest the code is running just fine …
Can you please guide me what am i doing wrong!
The code i am using is given below!
function db = name_value_pairs(varargin)
d=0;
if (nargin == 0 || rem(length(varargin),2)~=0)
d = cell (0,0);
else
for i = 1:2:length(varargin)-1
if ~ischar(varargin{i})
d= cel(0,0);
break
end
end
end
if isequal(d,cell(0,0))
db = cell(0,0);
else
db = reshape(varargin,2,length(varargin)/2)' ;
end
end