필터 지우기
필터 지우기

putting several matrices as one

조회 수: 1 (최근 30일)
AA
AA 2017년 10월 10일
편집: per isakson 2017년 10월 10일
i have got one matrix with 2 columns and another with 5. i want to put them togehter as one matrix with 7 columns. overall the rows are similar in all of them

채택된 답변

per isakson
per isakson 2017년 10월 10일
편집: per isakson 2017년 10월 10일
The matrices must have the same number of rows and have values of the same class.
len = 7;
A1 = ones( len, 2 );
A2 = 2*ones( len, 5 );
M = cat( 2, A1, A2 ); % or shorter [A1,A2]
whos M
returns
Name Size Bytes Class Attributes
M 7x7 392 double

추가 답변 (1개)

Cedric
Cedric 2017년 10월 10일
A = randi( 10, 3, 2 )
B = randi( 10, 3, 5 )
C = [A, B]

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by