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: Fit_sFIR.m
    path of file: ./repos/CanlabCore/CanlabCore/HRF_Est_Toolbox2
    
    the code of the file until where you have to start completion: function [hrf, fit, e, param] = Fit_sFIR(tc, TR, Run, T, mode)
% function [hrf, fit, e, param] = Fit_sFIR(tc,TR,Runs,T,mode)
%
% Fits FIR and smooth FIR model  
%
% INPUTS:
% 
% tc    - time course
% TR    - time resolution
% Runs  - expermental design
% T     - length of estimated HRF
% mode  - FIR or smooth FIR

    
function [hrf, fit, e, param] = Fit_sFIR(tc, TR, Run, T, mode)
% function [hrf, fit, e, param] = Fit_sFIR(tc,TR,Runs,T,mode)
%
% Fits FIR and smooth FIR model  
%
% INPUTS:
% 
% tc    - time course
% TR    - time resolution
% Runs  - expermental design
% T     - length of estimated HRF
% mode  - FIR or smooth FIR
%   options:
%       0 - standard FIR 
%       1 - smooth FIR
% 
% OUTPUTS:
%
% hrf   - estimated hemodynamic response function
% fit   - estimated time course
% e     - residual time course
% param - estimated amplitude, height and width
%
% Created by Martin Lindquist on 10/02/09
% Last edited: 05/17/13 (ML)

numstim = length(Run);
len = length(Run{1});
t=1:TR:T;
tlen = length(t);

Runs = zeros(len,numstim);
for i=1:numstim
    Runs(:,i) = Run{i};
end