行列の大きさをそろえる
46 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Keito Endo
el 3 de Oct. de 2021
Respondida: Keito Endo
el 4 de Oct. de 2021
A = [5 2 3]
B = [6 9 4 1 4]、、
と様々な大きさの行列が数十種類あります。これらの行列を1行10列の行列に揃えたいです。
大きくした分は0などで補えれば良いかなと思っているのですが何か解決策有りますでしょうか。
例
A = [5 2 3 0 0 0 0 0 0 0]
B = [6 9 4 1 4 0 0 0 0 0]、、、
0 comentarios
Respuesta aceptada
Más respuestas (1)
Toru Ikegami
el 3 de Oct. de 2021
こんにちは,元の行列のサイズは全て1行n列(n < 10)だと仮定しての解決策になりますが,
A = [ 3 2 3]
B = [ 6 9 4 1 4]
に対して,
A(end+1:10) = 0
B(end+1:10) = 0
でそれぞれ1行10列の行列になります.(空いている要素は0で補っています)
0 comentarios
Ver también
Categorías
Más información sobre Multidimensional Arrays en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!