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: icatb_constrained_lse.m
    path of file: ./repos/gift/GroupICAT/icatb/icatb_helper_functions
    
    the code of the file until where you have to start completion: function [beta_weights, line_fit] = icatb_constrained_lse(X, data, C)
%% Function to solve constrained least squares problem (y = XB + b) subject to equality
% constraint (CX = 0) using QR decomposition. 
%
% Inputs:
% 1. X - Design matrix
% 2. data - Data
% 3. C - Constraints matrix
% 

    
function [beta_weights, line_fit] = icatb_constrained_lse(X, data, C)
%% Function to solve constrained least squares problem (y = XB + b) subject to equality
% constraint (CX = 0) using QR decomposition. 
%
% Inputs:
% 1. X - Design matrix
% 2. data - Data
% 3. C - Constraints matrix
% 
% Outputs:
% 1. beta_weights - Beta weights
% 2. line_fit - Line fit
%

[num_rows, num_cols] = size(X);

data = data(:);

dataLength = length(data);

if (num_rows ~= dataLength)
    error('Error:DataLength', 'No. of rows (%d) of design matrix must be the same as the length of the data (%d)\n', num_rows, dataLength);
end