How to add limited row to specific row
1 次查看(过去 30 天)
显示 更早的评论
Hello all I'm student I'll be glad to help me to solve below problem, that I've two matrices A is 2x9 and B is 6x3,
A= zeros(2,9)
A =
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
B=round(10*rand(6,3))
B =
7 6 9
6 7 8
4 1 7
1 1 1
8 5 1
3 5 1
by using these codes I want to add first three row of matrix B to first row of A and second three rows of matrix B to second row of matrix A by using these codes :::
for i=1:6
if i<=3
x=x(y,:)
else
end
end
I tried I don't know how inside if condition
0 个评论
采纳的回答
Andrei Bobrov
2013-9-26
A= zeros(2,9);
B = [7 6 9
6 7 8
4 1 7
1 1 1
8 5 1
3 5 1];
out = reshape(B',fliplr(size(A)))'
0 个评论
更多回答(2 个)
另请参阅
类别
在 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!