How to find number of elements using a for loop

조회 수: 2 (최근 30일)
Johnathan Turner
Johnathan Turner 2021년 2월 18일
답변: Matt J 2021년 2월 18일
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 2021년 2월 18일
for i=1:numel(A), A(i)>2, end

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by