配列に数字を代入するプログラムについて
3 views (last 30 days)
Show older comments
1 1
1 2
1 3
1 4
1 5
2 1
2 2
2 3
2 4
2 5
3 1
3 2
このような2列目が5までいったら、1列目が1ふえるような配列をつくりたいのです。
どのようなプログラムにすればいいですか。
2 Comments
Accepted Answer
Toru Ikegami
on 3 Dec 2021
こんにちは,
一桁目だけを1から5で回すならば,次のようなコードはいかがでしょうか.
x = (1:20)';
y = 10*(floor((x-1)/5))+mod(x-1,5)+1;
disp(y);
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!