三次元の形状変換

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

Accepted Answer

Atsushi Ueno
Atsushi Ueno on 29 Oct 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

More Answers (0)

Categories

Find more on Resizing and Reshaping Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!