MATLAB: How to store values from loop in an array

image processing

v=[1 2 3;4 5 6;7 8 9]
l2=zeros(3,1)
for i=1:3
l2=norm(v((i),:),2)
end
i want to store store l2 values in an array.

Best Answer

v=[1 2 3;4 5 6;7 8 9] ;
l2=zeros(3,1) ;
for i=1:3
l2(i) = norm(v((i),:),2) ;
end
Read about MATLAB matrix indexing.....