How can I combine two matrix ?
2 次查看(过去 30 天)
显示 更早的评论
Hi I want to combine two matrix(matrix1= e1(743,7), matrix2= e2(743,7)), in the form of taking the first column of the first matrix and then the first from matrix2 then again the first from matrix1 and the second from matrix2 and so on. =>
e=[e1(:,1),e2(:,1),e1(:,1),e2(:,2)...,e1(:,1),e2(:,7),e1(:,2),e2(:,1)...,e1(:,2),e2(:,7),...,e1(:,7),e2(:,1)...e1(:,7),e2(:,7)]
Can somebody helps me how to create such a matrix e which is than a 743:49 matrix?
2 个评论
采纳的回答
更多回答(1 个)
James Tursa
2016-1-8
Another way:
[y x] = ndgrid((1:7)+7,(1:7));
z = [x(:)';y(:)'];
ee = [e1 e2];
e = ee(:,z(:));
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Multidimensional Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!