MATLAB: Making answer into array

for loopmatrix array

How can I concatenate my answers from a for-loop into an array. consider this example:
a=[2 1 3 1
1 4 1 5
6 7 1 1
8 1 9 1];
for i=(1:4)
row=(a(i,:));
b=sort(row)
end
I need an answer which is (b= 4×4 array) like the original (a)
cheers.

Best Answer

Are you trying to do:
a = [2 1 3 1
1 4 1 5
6 7 1 1
8 1 9 1];
sort(a,2)
ans =
1 1 2 3
1 1 4 5
1 1 6 7
1 1 8 9