How to create a matrix with a for- loop
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi, i'm trying to create a matrix using a for-loop and conditional.
I want to create
B= 1 1 1
0 0 0
1 1 1
0 Kommentare
Antworten (2)
Amit Bhowmick
am 1 Jul. 2021
Check with this
n=3;
B=zeros(n);
for ii=1:n
for jj=1:n
B(ii,jj)=rem(ii,2);
end
end
0 Kommentare
Siehe auch
Kategorien
Mehr zu Logical 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!