Skip to Main Content Skip to Search
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Doug’s Pick of the Week

September 11th, 2007

MATLAB Basics video: Sorting matrices

This video covers how to sort a matrix, either sorting each column independently or sorting such that the original rows stay together. Most new users are able to find the SORT command without much problem, but the very useful SORTROWS is often missed.

Find the files here.

Other videos have been gathered here:
http://blogs.mathworks.com/pick/category/video/

Other MATLAB Basics posts have been gathered here:
http://blogs.mathworks.com/pick/category/matlab-basics/

3 Responses to “MATLAB Basics video: Sorting matrices”

  1. slaesche replied on :

    Good tip! Just what I was looking for. Thanks.

  2. mayank replied on :

    Hi,I want to sort the coordiantes.How to do this?
    Eg- 1 0
    3 2
    21 0
    4 4
    2 3
    5 4
    so that the sorted coordinates come out to be:
    1 0
    21 0
    3 2
    2 3
    4 4
    5 4

  3. Doug replied on :

    Mayank,

    Please watch the video again. You will see Sortrows at the end. This is the function you are looking for.

    Doug

Leave a Reply


Doug Hull is an Application Engineer at The MathWorks. A MATLAB user since 1994, he gets paid to live, eat, and breathe MATLAB! This blog is dedicated to promoting the File Exchange by highlighting files and original video content.



  • Moran: Hi Chris, I tried everything I could think of, and have sent several observations about this bug to support,...
  • odessit: Hello, I have compiled standalone application with deploytool. It would work fine, but the error is in...
  • Duane Hanselman: FYI… % strmatch replacements % strmatch is obsolete, strncmp and strcmp are built in % case...
  • Doug: Duane, I just looked, I did not see an m-lint warning against STRMATCH in 2008a. However, I seem to recall what...
  • hashem: Hi Doug, I built a GUI and write a help for it in “chm” (compiled HTML file) format, and I...
  • Tim Davis: I left out the comments in the code, above. Most of the functions should be familiar to most MATLAB users....
  • Tim Davis: I was a little confused by all the back-and-forth discussion of zero blocks. Is a block of zeros to be...
  • Tim Davis: Try this one. It doesn’t require any toolboxes, just “sparse” and “dmperm” ....
  • Duane Hanselman: Did anyone ever try replacing strmatch with strcmp (or its siblings as needed)? I recall mlint...
  • jiro: @Daniel, We do use the hardware, but we don’t expose the supersampling feature through that path, so if...

These postings are the author's and don't necessarily represent the opinions of The MathWorks.

Related Topics