Save part of an array
8 次查看(过去 30 天)
显示 更早的评论
Hello, For example I have the matrix A = [1 2 3 4 5 6 7 8 9 10.....10000]. And I want to save in a matrix B(k) where B(1) = the first 20 elements of A so B(1) = [1...20], B(2) = [21...40], B(3) = [41...60] etc... Thank you :)
0 个评论
采纳的回答
Shameer Parmar
2016-6-15
Hello Sonarine,
Try for this..
A = [1:10000];
for i = 1:length(A)/20
B(i,:) = A((i-1)*20+1:i*20);
end
to check the output..
B(1,:)
B(2,:)
So on..
0 个评论
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrices and Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!