function total_sum = colsum_ones

if labindex == 1
    % On the first lab, generate a matrix of ones of the size NxN
    % where N is the total number of labs
    M = ones(numlabs)
    % Send the matrix M to the other labs
    A = labBroadcast(1,M);
else
    % Receive broadcast on other labs
    A = labBroadcast(1);
    % Multiply by the labindex
    A = A * labindex
end

% Calculate sum of column identified by labindex for this lab
column_sum = sum(A(:,labindex))

% Calculate total sum by combining column sum from all labs
total_sum = gplus(column_sum);

% Print the results from the lab with the highest id
if labindex==numlabs
    fprintf('\n-------------------\nTotal colsum is: %4d\n',total_sum);
end
