Group Abstract Group Abstract

Message Boards Message Boards

0
|
5K Views
|
2 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Selecting by sub-data based on algebraic condition

Posted 11 years ago

Let's say my array of

data = {{x1, y1},{x2,y2},....{xn,yn}}

I want to find the number of elements in my array such that these elements have a yi value with designated bounds. E.g. Find all yi such that 1< yi1, yi2, yi3, ... etc < 2. How do I code this?

POSTED BY: Teddy Ong
2 Replies
POSTED BY: Vitaliy Kaurov
Posted 11 years ago

Here is some code:

data = {{1, 2}, {3, 4}, {5, 6}, {7, 8}};
lower = 4;
upper = 6;
selection = Select[data[[All, 2]], # >= lower && # <= upper &];
Length@selection
POSTED BY: Priyan Fernando
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard