Matrix B from column of matrix A with condition
1 次查看(过去 30 天)
显示 更早的评论
Hello,
I have to create matix B that contains columns of matrix A which product of elements are greater than 20. How can i code this? Thanks.
0 个评论
采纳的回答
Mouhamed Niasse
2021-6-13
编辑:Mouhamed Niasse
2021-6-13
Hello,
Here is what i achieved. Hope you can easily understand it.
A=randi(5,5) % Just for an example, A is a 5x5 array of random integers
B=A(:,prod(A)>20) % This is the only line you'll need for any given matrix A.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!