compute the mean of matrices with different dimensions

4 次查看(过去 30 天)
I have three matrices of dimensions: matrixA: [2730 512], matrixB: [2730 512], and matrixC: [2730 256]. How do I reshape matrixC to [2730 512] by filling empty cells with zeros and compute the average of the three matrices so that the resultant matrix will be of dimension [2730 512]?

采纳的回答

Stephen23
Stephen23 2018-12-31
编辑:Stephen23 2018-12-31
Z = nan(2370,512,3);
Z(:,1:512,1) = A;
Z(:,1:512,2) = B;
Z(:,1:256,3) = C;
mean(Z,3)

更多回答(1 个)

madhan ravi
madhan ravi 2018-12-31
Simple example:
A=rand(3,3);
B=rand(3,3);
C=rand(3,2);
C=[C zeros(size(A,2),1)]

类别

Help CenterFile Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by