Function sortrows - sorting strings, MATLAB in Statistics

function sortrows - sorting strings:

The function sortrows sorts each and every row as a block, or group, and it also will work on numbers. Here in this illustration the rows starting with 3 and 4 are placed first then, for the rows starting with 5, the values in the second column (6 and7) determine the order.

>> mat = [5 7 2; 4 6 7; 3 4 1; 5 6 2]

mat =

5 7 2

4 6 7

3 4 1

5 6 2

>> sortrows(mat)

ans =

3 4 1

4 6 7

5 6 2

5 7 2

Posted Date: 10/22/2012 7:48:04 AM | Location : United States







Related Discussions:- Function sortrows - sorting strings, Assignment Help, Ask Question on Function sortrows - sorting strings, Get Answer, Expert's Help, Function sortrows - sorting strings Discussions

Write discussion on Function sortrows - sorting strings
Your posts are moderated
Related Questions
Opening and Closing a File: The Files are opened with the fopen function. By the default, fopen function opens a file for reading. If the other mode is preferred, a permission

Reading from Files: There are many lower level functions which read from files. The function fscanf reads the formatted data into a matrix, by using conversion formats like %s

Program of Persistent variables: The program below elaborates this. The script calls a function func1 that initializes a variable count to 0, then increment it, and print the

Index vector: The index vector is then used as the indices for original vector. To get grades vector in ascending order, the indices used would be grades (2), grades (5), and

Advanced File Input and Output: In that section, we saw how to read the values entered by user using the input as well as the output functions disp and fprintf, that shows inf

Example of sorting strings: To sort a cell array of strings, also the sort function is used. The illustration is as follows, >> engcellnames = {'Chemical','Mechanical',.

Generic code for Reading from Files: The generic code to complete this is as shown below:   fid = fopen('filename'); if fid == -1    disp('File open not suc

Advanced File Input and output: Where 'format' involves the conversion characters much like those used in the fprintf function. For illustration, to read the file 'subjexp.dat

Areacirc function: The areacirc function can be called from the Command Window as shown here, or from a script. Here is a script which will prompt the user for the radius of o

Run-time or execution-time error: The Run-time, or execution-time, errors are found whenever a script or function is executing. With most of the languages, an illustration of