function [KO]=addk(KO,ko,id,icol);

%----------------------------------------------------------
%  Purpose:
%     Assembly of element matrices into the system matrix
%
%  Synopsis:
%     [KO]=addk(KO,ko,id,iel)
%
%  Variable Description:
%     KO  - structural system stiffness matrix - 1st order
%     ko   - element stiffness matrix - 1st order(size of 6x6)
%     id  - connectivity array (size of 6 x nel)
%     icol - column of the connectivity array to be used
%
%  Internal Variables
%     index - d.o.f. vector associated with an element (size of 6x1)
%-----------------------------------------------------------

 
 edof = length(id);
 index = id(:,icol);
 for i=1:edof
   ii=index(i);
   if ii ~= 0
     for j=1:edof
       jj=index(j);
       if jj ~= 0
         KO(ii,jj)=KO(ii,jj)+ko(i,j);
     else end
     end
 else end
 end