How can I remove rows from a matrix with a for statement and if statement?

1 view (last 30 days)
I want to remove any of the rows from matrix A whose column 1 is either greater than the max value or less than the min value.
I get the following error:
What am I doing wrong here?

Accepted Answer

madhan ravi
madhan ravi on 31 Mar 2019
No loop, if and elseif needed:
A((A(:,1)>maxvalue)|(A(:,1)<minvalue),:)=[]

More Answers (1)

Walter Roberson
Walter Roberson on 31 Mar 2019

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!