turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- Effective method to test matrix columns

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Sep 18, 2014 9:46 AM
(1859 views)

Hello all ,

I have a matrix with 5 columns . I want to filter the matrices for a specific condition so lets say MinValue = 20 and the name of my matrix is Data .

How can I filter the values in each column using the MinValue and replace everything which fails the condition with NULL . How can I do it if I were to do it for the entire matrix and specifically for one or more columns ?

For Eg :

Col1 Col2 Col3 Col4 Col5

50 2 60 40 10

10 10 10 10 10

21 22 23 19 24

Output should be

Col1 Col2 Col3 Col4 Col5

50 NULL 60 40 NULL

NULL NULL NULL NULL NULL

21 22 23 NULL 24

I dont want to use loops if there is a possibility .

Regards

Uday

Best

Uday

Uday

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Sep 18, 2014 11:18 AM
(3484 views)

Solution

If I'm understanding your question correctly, the **loc()** function in JSL should help:

minValue = 20;

data = [

50 2 60 40 10,

10 10 10 10 10,

21 22 23 19 24];

data[loc(data<20)] = .;

show(data);

Michael Crotty

Sr Statistical Writer

JMP Development

Sr Statistical Writer

JMP Development

3 REPLIES

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Sep 18, 2014 11:18 AM
(3485 views)

If I'm understanding your question correctly, the **loc()** function in JSL should help:

minValue = 20;

data = [

50 2 60 40 10,

10 10 10 10 10,

21 22 23 19 24];

data[loc(data<20)] = .;

show(data);

Michael Crotty

Sr Statistical Writer

JMP Development

Sr Statistical Writer

JMP Development

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Sep 18, 2014 11:21 AM
(1742 views)

Hello Michael ,

How does that replace the selected data with NULLS ?

Uday

Best

Uday

Uday

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Sep 18, 2014 12:21 PM
(1742 views)

The **loc()** function is returning a vector of positions (locations) in the matrix where the value is less than 20. Then I am using the vector of positions as a subscript to the matrix and assigning a missing value (the period) to those positions in the matrix.

Michael Crotty

Sr Statistical Writer

JMP Development

Sr Statistical Writer

JMP Development