- You can change the matrix dimension by using the "reshape" function. Note that, "reshape" function reads elements of matrix columnwise first and then row-wise for reshaping it. For more information, you can check the documentation for "reshape".
How to convert a multidimensional matrix into 2D ?
3 ビュー (過去 30 日間)
回答 (1 件)
Santosh Fatale 2022 年 12 月 15 日
There are multiple options to do so.
Option 1: Use the "reshape" function
Option 2: Write a simple code, as below, to stack matrices one after another.
NewA = zeros(101*101, 101); % A is original matrix.
% Here I am stacking 2-D matrices after one another with respect to the third
for idx3 = 1 : 101
NewA(1+((idx3-1)*101):(idx3*101),:) = A(:,:,idx3);