How to find number of elements using a for loop

2 views (last 30 days)
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

Answers (1)

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

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!