function HW02P02_208117184 clc A=[5 4 1; 2 6 4; 9 6 5 ] a=size(A); t=0; A=sort(A) for i= 1:a(1) b(i,:)= sort(A(i,:)); B=[b(i,:); end
Show older comments
function HW02P02_208117184
clc
A=[5 4 1; 2 6 4; 9 6 5 ]
a=size(A);
t=0;
A=sort(A)
for i= 1:a(1)
b(i,:)= sort(A(i,:));
B=[b(i,:);
end
the program returns the last b(i,:) how can i save each row that results in each for loop and save them in a matrix ?
Answers (2)
Walter Roberson
on 5 Mar 2013
Change
B=[b(i,:);
to
a_matrix(i, :) = b(i,:);
Azzi Abdelmalek
on 5 Mar 2013
clc
A=[5 4 1; 2 6 4; 9 6 5 ]
t=0;
A=sort(A)
B=sort(A,2)
Categories
Find more on Language Fundamentals in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!