putting several matrices as one
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
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
0 个评论
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Function Creation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!