三次元の形状変換

18 visualizaciones (últimos 30 días)
sz
sz el 29 de Oct. de 2021
Respondida: Atsushi Ueno el 29 de Oct. de 2021
現在19×231250×19の3次元行列があります。
これを19×19×231250にして、
19×19の361個分を一つの列に並べて231250×361の二次元行列に変更したいのですが出来ません。
スクリプトが分かれば送っていただきたいです。
19×231250×19の行列は下記の乱数ので大丈夫です。
よろしくお願いいたします.
X=rand([19,231250,19])

Respuesta aceptada

Atsushi Ueno
Atsushi Ueno el 29 de Oct. de 2021
X = rand([19,231250,19]); % 現在19×231250×19の3次元行列があります
Y = permute(X,[1 3 2]); % これを19×19×231250にして
Z = reshape(Y,[361,231250]); % 19×19の361個分を一つの列に並べて
A = Z'; % 231250×361の二次元行列に変更
size(X)
ans = 1×3
19 231250 19
size(Y)
ans = 1×3
19 19 231250
size(Z)
ans = 1×2
361 231250
size(A)
ans = 1×2
231250 361

Más respuestas (0)

Categorías

Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!