selecting elements from an array
2 次查看(过去 30 天)
显示 更早的评论
hi all,
I have an array 3x258, is there any way to create two different arrays where the first one will contain the columns that their last element is negative, and the other one the rest of them? thanks!
0 个评论
采纳的回答
Adam
2017-2-20
idx = myArray( end, : ) < 0;
negLastElementCols = myArray( :, idx );
theRest = myArray( :, ~idx );
更多回答(0 个)
另请参阅
类别
在 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!