How to create a matrix with a for- loop
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (2 件)
Amit Bhowmick
2021 年 7 月 1 日
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 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!