Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7086725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:35:08+00:00 2026-05-28T07:35:08+00:00

I have an array which can be any size (in rows) but is always

  • 0

I have an array which can be any size (in rows) but is always two columns wide. I would like to throw away any rows containing numbers which stray more than 1 from the median of each column.

For example:

array =
 2 5
 3 4
 9 5
 2 8
 3 5
 . .
 . .
 . .
 etc

In the above example, median(array) gives [2 5]. So, for the columns above, I would expect the third and fourth rows to be eliminated, since row three contains 9 in the first column, and row four contains 8 in the second column, both of which are outside of my limit (1 away from the median). Note that I want to throw away BOTH columns if EITHER column contains a number which is not within 1 of the median for that column.

Any help would be greatly appreciated…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T07:35:08+00:00Added an answer on May 28, 2026 at 7:35 am

    I don’t have MATLAB right now, but I think this should work. You should be able to at least follow the logic.

    med = median(arrray);
    arrayNew = array( ( abs(array(:,1)-med(1))<=1 ) & ( abs(array(:,2)-med(1))<=2 ), : );
    

    What the above code is doing is finding all indices where array value in both columns is at most distance 1 from median of each column. Then it selects only those rows that corresponds to these indices.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two questions: 1) How can I make an array which points to
I have an array which could be of any size coming from users. The
I have an array which contains around 50-200 hyperlinks. How can I pass this
I have a generated nested Array which I store some data. How can i
I have an array which contains another array Would I notate it this way?
i have an array which could look like this: $config[$name][$array]['key'] = 'value'; // here
Once again, I have a problem for which I would like to shave off
I have an array which is a list of domains, I want to print
I have an array which has the contents as the result of an sql
I have an array which i need to sort its elements by occurrence then

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.