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: mat_add.m
    path of file: ./repos/Algorithms_MathModels/《基于MATLAB的高等数学问题求解》 随书附带源程序/CH02
    
    the code of the file until where you have to start completion: function C=mat_add(varargin)                    
%MAT_ADD   求任意个相同维数矩阵的和                         
% C=MAT_ADD(A,B,...)  计算多个矩阵的和                  
%                                               
% 输入参数：                                         
%     ---A,B,...：维数相同的矩阵                        
% 输出参数：                                         
%     ---C：返回的和矩阵                               
                                                

    
function C=mat_add(varargin)                    
%MAT_ADD   求任意个相同维数矩阵的和                         
% C=MAT_ADD(A,B,...)  计算多个矩阵的和                  
%                                               
% 输入参数：                                         
%     ---A,B,...：维数相同的矩阵                        
% 输出参数：                                         
%     ---C：返回的和矩阵                               
                                                
error(nargchk(2,inf,nargin))                    
C=varargin{1};                                  
s=size(C);                                      
for k=2:numel(varargin)                         
    B=varargin{k};                              
    s1=size(B);                                 
    if isequal(s,s1)                            
        C=C+B;                                  
    else                                        
        error('Martix dimension does''t match.')
    end