finding the columns include ones

1 次查看(过去 30 天)
matrix=[1 0 0 1 0;0 1 0 1 0];
% I need to find the number of column includes [1;1]
index_1 = 4 ;
% how can I find this using code or function?

采纳的回答

madhan ravi
madhan ravi 2024-1-6
index = find(all(matrix)) % one can directly use logical indexing without find() function

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by