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: chop.m
    path of file: ./repos/BrainStat/brainstat_matlab/widely_useful
    
    the code of the file until where you have to start completion: function X = chop(Xin,n,unit)
%CHOP   CHOP(X,n) rounds elements of X to n significant figures.
%       CHOP(X,n,unit) rounds the elements of X to n significant
%   figures whose digits (mantissa) are exactly divisible
%   by unit. 
%       
%       e.g. chop(3.141592,5)   returns 3.141600000..

    
function X = chop(Xin,n,unit)
%CHOP   CHOP(X,n) rounds elements of X to n significant figures.
%       CHOP(X,n,unit) rounds the elements of X to n significant
%   figures whose digits (mantissa) are exactly divisible
%   by unit. 
%       
%       e.g. chop(3.141592,5)   returns 3.141600000..
%       e.g. chop(3.141592,3,5) returns 3.150000000..
%            chop(3.141592,3,3) returns 3.150000000..
%            chop(3.141592,3,2) returns 3.140000000..
%      

%   Copyright 1986-2002 The MathWorks, Inc. 

% Set last sig. fig. rounding to 1 if only two input arguments.
if nargin<3,
   unit=1; 
end