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 6032175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:17:42+00:00 2026-05-23T05:17:42+00:00

Is it possible to achieve the same functionality with sort function than using sortrows.

  • 0

Is it possible to achieve the same functionality with sort function than using sortrows. My matrix has over 4million+ rows and sortrows is bringing in a lot of latency because of iterations. (a vectorizated approach would be appreciated)

%Col1 -> date, Col2 -> id, Col3 -> ranking within each date-group (to help you debug)
data = [ ...
       734614 5 3; 734615 6 5; 734622 1 1; 734615 1 1; 734615 4 3; 
       734622 2 2; 734622 4 3;   734615 3 2; 734615 5 4; 734614 3 2; 
       734614 1 1; 734622 8 4; 734622 9 5;] ;

sortedanswer = 
  734614           1           1
  734614           3           2
  734614           5           3
  734615           1           1
  734615           3           2
  734615           4           3
  734615           5           4
  734615           6           5
  734622           1           1
  734622           2           2
  734622           4           3
  734622           8           4
  734622           9           5

Thanks!

  • 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-23T05:17:43+00:00Added an answer on May 23, 2026 at 5:17 am

    You could do it as

    [~,indx]=sort(data(:,1));
    sortedanswer=data(indx,:)
    
    sortedanswer =
    
          734614           5           3
          734614           3           2
          734614           1           1
          734615           6           5
          734615           1           1
          734615           4           3
          734615           3           2
          734615           5           4
          734622           1           1
          734622           2           2
          734622           4           3
          734622           8           4
          734622           9           5
    

    Note that it is sorted by the rows in the first column. The order of the rows is the same as that in the original data, which is why you see 5 3 in the second and third columns in the first row in mine.

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

Sidebar

Related Questions

Is this possible to configure IIS7 to achieve the same functionality like Apache has
Is it possible to achieve the same effect of any hardware independent functionality from
Do you think it is possible to achieve the same performance found in [Apache
Is it possible to achieve better data transfer rate with multiple parallel TCP connections
Is it really possible to achieve grade A in yslow for all things for
What are the best resources for understanding what's possible (or not possible) to achieve
Is it possible in opengl to setup blending to achieve additive color overlays? Red
I'm not sure if this is possible what I'm trying to achieve. I want
I know Powershell has background job functionality with Start-Job , Wait-Job , etc., but
I'm trying to achieve high frame-per-second on Windows GDI by using Windows Timer Queues.

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.