function eq2 = assign(a,index,val)
%
% assign: assigns given index to new val (used in label8)
% On input:
%     a:
%     index:
%     val:
% On output
%     eq2: 
% Call:
%     eq2 = assign(a,index,val)
%

eq2 = (a==index)*val + (a~=index).*a
