Since there's generally no guarantee that the rows have the same number of unique elements, then I wouldn't assume that would work. Unless you can guarantee that for your specific case, then use a cell array to store the output. Since you didn't say why the result wasn't right, I'm just going to guess.
theta = [1 2 3 1 2 3 1 2 3; 4 5 6 4 5 6 4 5 6; 5 4 2 5 4 2 5 4 2]
nrows = size(theta,1);
T = cell(nrows,1);
for r = 1:nrows
T{r} = unique(theta(r,:),'stable');
end
celldisp(T)
I suppose it's possible to convert the cell array to a numeric array if it turns out to be rectangular.
T = cell2mat(T)