配列に数字を代入するプログラムについて
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
Atsushi Ueno
il 3 Dic 2021
Spostato: Atsushi Ueno
il 17 Ago 2022
配列の添え字として使うのであれば、ind2sub関数を使う事が出来ます。あっ
x = (1:20)';
[row col] = ind2sub([5 4], x);
disp([col row]); % MATLABのデフォルトは列優先
Toru Ikegami
il 3 Dic 2021
Spostato: Atsushi Ueno
il 17 Ago 2022
おー.美しいですね.素晴らしい.
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Matrix Indexing in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!