MATLAB Answers

How to find number of elements using a for loop

조회 수: 13(최근 30일)
Johnathan Turner
Johnathan Turner 18 Feb 2021
답변: Matt J 18 Feb 2021
Hello I have an matrix like this A=[1,2,7,2,2,7; 5,4,9,5,4,2]
Using a for loop I need to find the elements larger than 2

답변(1개)

Matt J
Matt J 18 Feb 2021
for i=1:numel(A), A(i)>2, end

태그

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by