How to select rows from an array?
161 次查看(过去 30 天)
显示 更早的评论
I have matrix of A . I need to select the 2nd, 4th and 6th row. How can I write that in MATLAB code?
0 个评论
回答(3 个)
Torsten
2022-10-12
B = [A(2,:);A(4,:);A(6,:)]
or if you want the rows one by one:
A2 = A(2,:);
A4 = A(4,:);
A6 = A(6,:);
0 个评论
另请参阅
类别
在 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!