配列に数字を代入するプログラムについて
Mostrar comentarios más antiguos
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 comentarios
Atsushi Ueno
el 3 de Dic. de 2021
Movida: Atsushi Ueno
el 17 de Ag. de 2022
配列の添え字として使うのであれば、ind2sub関数を使う事が出来ます。あっ
x = (1:20)';
[row col] = ind2sub([5 4], x);
disp([col row]); % MATLABのデフォルトは列優先
Toru Ikegami
el 3 de Dic. de 2021
Movida: Atsushi Ueno
el 17 de Ag. de 2022
おー.美しいですね.素晴らしい.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Matrix Indexing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!