Searching a Table for rows that meet specific criteria

I have a table that has length in column1 and mass in column2. i want to search this table for every row where column1 is between 0.35 and 0.32, and where column 2 is less than 1.3. but im unsure of how to do this. any help is appreciated.

0 Comments

Accepted Answer

Cris LaPierre on 15 Dec 2020

Direct link to this answer

Cancel Copy to Clipboard

Direct link to this answer

Cancel Copy to Clipboard

You can use logical indexing . You can use multiple conditional expressions to create your logical index. The result is an array the length of your conditional data. A 1 means the condition(s) were met, and 0 means they were not. Use that to index the original array.

0.8273 0.8719 0.0490 0.9542 0.0813 0.2350 0.7649 0.1481 0.7011 0.7902 0.7649 0.1481
1 Comment
Joe Jackson on 15 Dec 2020

Direct link to this comment

Cancel Copy to Clipboard

Direct link to this comment

Cancel Copy to Clipboard thanks! been stuck for ages i'm new to matlab and enjoying learning it!

More Answers (0)

See Also

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

An Error Occurred

Unable to complete the action because of changes made to the page. Reload the page to see its updated state.

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list

How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.