Wipro Question: Download Wipro PDF

How can we sort the elements of the array in descending order in Wipro?

Tweet Share WhatsApp

Answer:

Syntax
B = sort(A)
B = sort(A,dim)
B = sort(...,mode)
[B,IX] = sort(A,...)

Description
B = sort(A) sorts the elements along different dimensions of an array, and arranges those elements in ascending order.
If A is a ... sort(A) ...
Vector Sorts the elements of A.
Matrix Sorts each column of A.
☼ Multidimensional array Sorts A along the first non-singleton dimension, and returns an array of sorted vectors.
☼ Cell array of strings Sorts the strings in ascending ASCII dictionary order, and returns a vector cell array of strings. The sort is case-sensitive; uppercase letters appear in the output before lowercase. You cannot use the dim or mode options with a cell array.

Download Wipro PDF Read All 35 Wipro Questions
Previous QuestionNext Question
What is Post-Condition in Wipro?How to sort array elements in ascending or descending order?