How do I assign rows of a matrix to an array?
80 次查看(过去 30 天)
显示 更早的评论
So I have a Matrix, say A =[1,2,3;4,5,6;7,8,9]
I need to create an array of [4,5,6;7,8,9]
I have been trying a thousand variations of B= num2cell(A(2,:)) and B= num2cell(A(3,:))
but all I can create is obviously just an array of either 4,5,6 or 7,8,9 not them combined.
Any advice?
0 个评论
采纳的回答
Image Analyst
2017-10-8
Don't mess with cells - too complicated. Just index the rows:
b = A(2:3, :) % Extract rows 2 to 3 only.
0 个评论
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!