Combining 2 matrices into 1

조회 수: 3 (최근 30일)
Julie De Weirdt
Julie De Weirdt 2020년 9월 15일
편집: KSSV 2020년 9월 15일
I have two numerical matrices A and B, both with 413 rows and 905 columns.
I would like to generate a new matrix that consists of 2 columns. The first column should list all values of matrix A (starting at the upperleft corner in row 1; column 1, and finishing in the righthand corner at row 413; column 905). A second column lists the corresponding values for matrix B.
Thank you in advance!

답변 (1개)

KSSV
KSSV 2020년 9월 15일
편집: KSSV 2020년 9월 15일
A = rand(413,1) ;
B = rand(905,1) ;
% Get A to size of B
x = (1:length(A))' ;
xi = linspace(1,length(A),length(B)) ;
A = interp1(x,A,xi)' ;
iwant = [A B]

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by