Deleting rows containing any number outside a specific range - MATLAB

AnnaSchumann

What is the best way to delete rows of a matrix containing a number outside a specific range? For example

A =

200  400
500  200
500  100
600  200
200  100
300  200

Range = [200 500];

Rows 3,4 and 5 would then be deleted as they contain numbers <200 and >500.

Divakar

This should work for you -

A(any(A<200 | A>500,2),:)=[];

To state that generally -

range1 = [200 500]; %// changed the variable name as 
                    %// range is already a builtin function name
A(any(A<range1(1) | A>range1(2),2),:)=[];

If the number of rows to be deleted is a lot, for performance you might as well index into the other rows instead of deleting -

range1 = [200 500];
A = A(~any(A<range1(1) | A>range1(2),2),:)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Constraining number of rows to a range

From Dev

Deleting variable names containing specific string

From Dev

Split row containing range into multiple rows by any number

From Dev

Deleting a specific rows and columns from a data-set using Matlab

From Dev

Deleting rows in datastore by time range

From Dev

Deleting nodes that are outside of a specific numeric range in a singly linked list

From Dev

MATLAB plot of a vector on a specific range

From Dev

Finding rows containing a value (or values) in any column

From Dev

Generate random number outside of range in python

From Dev

Matlab: extracting rows with specific datetime

From Dev

Tensorflow clamp values outside specific range

From Dev

Hello, can somebody help me or any suggstion code how can I start in conditional for getting the range of specific range number

From Dev

VBA to select specific number of rows on filtered range

From Dev

Deleting all rows in Excel after one containing searched for text

From Dev

Deleting nodes that are outside of a specific numeric range in a singly linked list

From Dev

deleting rows containing excel vba

From Dev

Deleting specific rows/columns from excel

From Dev

grep search for any number in a range

From Dev

Excel 2015 - Deleting rows that contain a specific string

From Dev

How to count the number of cells in a range containing a specific (sub)string with Excel/Calc?

From Dev

Deleting Specific Rows from Pandas Dataframe

From Dev

Selecting a range of rows that is the same number as a predefined range

From Dev

In Excel2016, I have a cell containing specific text and a number. I want to add that number to other numbers in a range

From Dev

Deleting [ ] Rows in Array Struct MATLAB

From Dev

deleting rows in R containing one blank column

From Dev

For loop for specific range of numbers in Matlab

From Dev

Sum Specific Rows Of Used Range

From Dev

Deleting "string" containing last rows from CSV file using regex

From Dev

vba Deleting specific rows and columns in a word table

Related Related

  1. 1

    Constraining number of rows to a range

  2. 2

    Deleting variable names containing specific string

  3. 3

    Split row containing range into multiple rows by any number

  4. 4

    Deleting a specific rows and columns from a data-set using Matlab

  5. 5

    Deleting rows in datastore by time range

  6. 6

    Deleting nodes that are outside of a specific numeric range in a singly linked list

  7. 7

    MATLAB plot of a vector on a specific range

  8. 8

    Finding rows containing a value (or values) in any column

  9. 9

    Generate random number outside of range in python

  10. 10

    Matlab: extracting rows with specific datetime

  11. 11

    Tensorflow clamp values outside specific range

  12. 12

    Hello, can somebody help me or any suggstion code how can I start in conditional for getting the range of specific range number

  13. 13

    VBA to select specific number of rows on filtered range

  14. 14

    Deleting all rows in Excel after one containing searched for text

  15. 15

    Deleting nodes that are outside of a specific numeric range in a singly linked list

  16. 16

    deleting rows containing excel vba

  17. 17

    Deleting specific rows/columns from excel

  18. 18

    grep search for any number in a range

  19. 19

    Excel 2015 - Deleting rows that contain a specific string

  20. 20

    How to count the number of cells in a range containing a specific (sub)string with Excel/Calc?

  21. 21

    Deleting Specific Rows from Pandas Dataframe

  22. 22

    Selecting a range of rows that is the same number as a predefined range

  23. 23

    In Excel2016, I have a cell containing specific text and a number. I want to add that number to other numbers in a range

  24. 24

    Deleting [ ] Rows in Array Struct MATLAB

  25. 25

    deleting rows in R containing one blank column

  26. 26

    For loop for specific range of numbers in Matlab

  27. 27

    Sum Specific Rows Of Used Range

  28. 28

    Deleting "string" containing last rows from CSV file using regex

  29. 29

    vba Deleting specific rows and columns in a word table

HotTag

Archive