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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:20:19+00:00 2026-05-28T08:20:19+00:00

I want to do what SQL’s GROUP BY does in MATLAB. For example, M

  • 0

I want to do what SQL’s GROUP BY does in MATLAB. For example,

M = [
1, 5;
2, 5;
3, 5;
1, 6;
2, 6;
1,7 ]

SQL: SELECT MAX(c1), c2 FROM M(c1, c2) GROUP BY 2

Result = [
3, 5;
2, 6;
1, 7]

How can I do this in Matlab?

  • 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-28T08:20:20+00:00Added an answer on May 28, 2026 at 8:20 am

    grpstats in the Statistics Toolbox can do this:

    >> [grpstats(M(:,1), M(:,2), {'max'}) unique(M(:,2))]
    
    ans =
    
         3     5
         2     6
         1     7
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to find a sql command or something that can do this where
i have table id pagenane username i want this sql query select pagename, count(*)
I want my SQL query can run like this. I have two tables: Key1,
I want this SQL query to be written in rails controller using find: select
I have aquestions from you. Does SQL server have any features so we can
I want to find an SQL query to find rows where field1 does not
I want to create a SQL Select to do a unit test in MS
I want make sql query which will insert values from one table to another
I want to compare and select a field from DB using Like keyword or
i want to open notepad, word or excel files from sql server using some

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.