Example of sorting strings, MATLAB in Statistics

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',.  .  .

     'Biomedical','Electrical', 'Industrial'};

>> sort(engcellnames')

ans =

  'Biomedical'

  'Chemical'

  'Electrical'

  'Industrial'

  'Mechanical'

 

 

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







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

Write discussion on Example of sorting strings
Your posts are moderated
Related Questions
Functions which return Values versus printing: Also, the function which computes and returns values (throughout the output arguments) does not generally print them; that is le

Illustration of reading from files: For illustration, suppose that there is a data file 'subjexp.dat' that has on each line a number followed by thecharacter code. The type fu

Sorting Strings: For the matrix of strings, the sort function works exactly as formerly for numbers. For illustration, >> words = char('Hi', 'Hello', 'Howdy', 'Goodbye', '

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

Illustration of Nested loops: Running the script shows the output: >> printstars ***** ***** ***** The variable rows identifies the number of rows to print, and

Vectorizing: In most of the cases in MATLAB, loops are not essential. As MATLAB is written specifically to work with the vectors and matrices, most operations can be completed

Example of Nested functions: For illustration, the function below computes and returns the volume of a cube. Three arguments are then passed to it, for the width and length of

Lower Level File I/O Functions: Whenever reading from data file, as long as the data in the file is "regular" the load function works-in another words, the similar type of dat

Illustration of Median When the vector is not in sorted order to start with, the median function will still return the right answer (it will sort the vector automatically). For

Illustration of tracing a error: The one way of following the flow of function, or tracing it, is to use the echo function. The echo function, that is a toggle, will show each