필터 지우기
필터 지우기

Combining K matrices in one matrix

조회 수: 2 (최근 30일)
shdotcom shdotcom
shdotcom shdotcom 2018년 11월 11일
편집: shdotcom shdotcom 2018년 11월 11일
Hi, I have K matrices of size [n,m]. For example:
K = 3;
n = 4;
m = 3
a = [1 2 3; 4 5 6; 7 8 9; 4 7 2];
b = [1 5 6; 3 1 2; 7 2 5; 6 8 3];
c = [4 1 7; 5 8 6; 3 5 9; 5 3 8];
X = [a11 b11 c11; a21 b21 c21; a31 b31 c31; a41 b41 c41;
a12 b12 c12; a22 b22 c22; a32 b32 c32; a42 b42 c42;
a13 b13 c13; a23 b23 c23; a33 b33 c33; a43 b43 c43];
% aij, bij and cij are the indexes of an element in matrix a, b and c
Is it possible to combine matrices a, b and c to create X, without using for statement?

채택된 답변

Bruno Luong
Bruno Luong 2018년 11월 11일
X = reshape(cat(3,a,b,c),[],3)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

태그

제품


릴리스

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by