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: oneVsAll.m
    path of file: ./repos/Machine-Learning--Coursera/machine-learning-ex3/ex3
    
    the code of the file until where you have to start completion: function [all_theta] = oneVsAll(X, y, num_labels, lambda)
%ONEVSALL trains multiple logistic regression classifiers and returns all
%the classifiers in a matrix all_theta, 
    
function will return theta and the cost 
%     [theta] = ...
%         fmincg (@(t)(lrCostFunction(t, X, (y == c), lambda)), ...
%                 initial_theta, options);
%
for k=1:num_labels  
    initial_theta = zeros(n + 1, 1);  
    options = optimset('GradObj', 'on', 'MaxIter', 50);  
    [theta] = fmincg (@(t)(lrCostFunction(t, X, (y == k), lambda)),initial_theta, options);  
    all_theta(k,:) = theta';  
end