配列に数字を代入するプログラムについて
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
Toru Ikegami
il 3 Dic 2021
こんにちは,
一桁目だけを1から5で回すならば,次のようなコードはいかがでしょうか.
x = (1:20)';
y = 10*(floor((x-1)/5))+mod(x-1,5)+1;
disp(y);
3 Commenti
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!