Combining 2 matrices into 1

7 ビュー (過去 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 Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by