help regarding for loop
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
James Kamwela
am 14 Okt. 2021
Beantwortet: Voss
am 14 Okt. 2021
Hello everyone, anyone knows how i can make this work using for loop or any other method, the matris at the end is supposed to be
z=[1 1 1 2 1 5 7;0 2 2 1 1 3 6;0 0 2 2 2 3 -8;0 0 0 1 1 6 8]
below is the code
Axb=[1 1 1 2 1 5 7;1 2 2 1 1 3 6;1 3 3 0 1 6 6;1 2 2 2 2 3 -8;1 1 1 1 1 6 8;3 5 9 3 4 3 1;2 2 5 1 8 9 5];
z=zeros(length(Axb),length(Axb));
z(1,:)=Axb(1,:);
Axb=Axb(2:end,2:end);
z=zeros(length(Axb),length(Axb));
z(2,:)=Axb(1,:);
z=zeros(length(Axb),length(Axb));
z(3,:)=Axb(1,:);
0 Kommentare
Akzeptierte Antwort
Voss
am 14 Okt. 2021
Axb=[1 1 1 2 1 5 7;1 2 2 1 1 3 6;1 3 3 0 1 6 6;1 2 2 2 2 3 -8;1 1 1 1 1 6 8;3 5 9 3 4 3 1;2 2 5 1 8 9 5];
z = Axb(1,:);
z(2,2:end) = Axb(2,2:end);
z(3,3:end) = Axb(4,3:end);
z(4,4:end) = Axb(5,4:end);
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!