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

  • SEARCH
  • Home
  • 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 8875203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:55:02+00:00 2026-06-14T18:55:02+00:00

I have a matrix sorted in ascending order. S = 25; RT = zeros(S,2);

  • 0

I have a matrix sorted in ascending order.

S = 25;
RT = zeros(S,2);
  for i = 1:S;
    for j = 1:i;
    R = i *j;
    T = R + j;
    RT(j,:) = [R T];
    end

  end
sortRT = sortrows(RT, [1 2]);
disp(sortRT);

I want to find the sortRT elements which values is lower than 500 (for R) and 490 (for T) per column and place these values inside a matrix. Is it possible?

  • 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-06-14T18:55:03+00:00Added an answer on June 14, 2026 at 6:55 pm

    Just use find:

    idx = find(sortRT(:,1)<500 & sortRT(:,2)<490)
    
    idx' = 
    
     1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18
    

    These are the rows where both R<500 and T<490. You can of course separate these two:

    idxR500 = find(sortRT(:,1)<500);
    idxT490 = find(sortRT(:,2)<490);
    

    If you’re just going to copy elements or rows, then find isn’t even necessary and you can use logical indexing:

    R500 = sortRT(find(sortRT(:,1)<500) , 1);
    

    is the same as

    R500 = sortRT(sortRT(:,1)<500 , 1);
    

    This copies elements of the first column, if you want to copy the whole row, use the colon operator:

    R500 = sortRT(sortRT(:,1)<500 , :);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a matrix A which I want to convert into a data.frame of
I have a matrix in MATLAB from which I want to sample every other
I have a matrix and i want to create a new matrix which will
I have a matrix in MATLAB and I need to find the 99% value
I have a matrix that stores x, y and z values as so: {x1,
I have a matrix m of zeros and a data-frame df containing records I
Say I have a matrix ( MxN ) which has its rows and columns
Hey! I have matrix class and i want to add, multiply and take transpose
I have A matrix part of which looks like this : 4080530 92 --
I have a matrix which has the following form: M = [1 4 56

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.