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: deepcopy.m
    path of file: ./repos/d2d/arFramework3/ThirdParty/StrucID/adimat/opt_sp_derivclass/private
    
    the code of the file until where you have to start completion: function rout= deepcopy(rin)
% deepcopy -- Copy a structure replacing each numerical object with a zero
%   matrix of same size.
%
% Copyright 2001-2004 Andre Vehreschild, Institute for Scientific Computing   
%                     RWTH Aachen University
% This code is under development! Use at your own risk! Duplication,
% modification and distribution FORBIDDEN!


   fname= fieldnames(rin);
   for i= 1: length(fname)

    
function rout= deepcopy(rin)
% deepcopy -- Copy a structure replacing each numerical object with a zero
%   matrix of same size.
%
% Copyright 2001-2004 Andre Vehreschild, Institute for Scientific Computing   
%                     RWTH Aachen University
% This code is under development! Use at your own risk! Duplication,
% modification and distribution FORBIDDEN!


   fname= fieldnames(rin);
   for i= 1: length(fname)
      curr= rin.(fname{i});
      if isstruct(curr)
         rout.(fname{i})= deepcopy(curr);
      elseif isnumeric(curr)
         if issparse(curr)
            rout.(fname{i})= sparse([],[],[], size(curr,1), size(curr,2));
         else
            rout.(fname{i})= zeros(size(curr));
         end