function [id, s] = MSRC(traindata, trainlabels, x, lambda)
% Use the extended SRC to classify data under occlusion



[s,status] = l1_ls(traindata, x, lambda); %%%http://www.stanford.edu/~body/l1_ls

classids = unique(trainlabels);
NumClass = length(classids);

r = zeros(NumClass, 1);
for i = 1:NumClass
    classidx = find(trainlabels == classids(i));
    classdata = traindata(:, classidx);
    si = s(classidx);
    err = norm(classdata*si - x);
    r(i) = err;
end

[minerr, id] = min(r);

id = classids(id);
