Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

could anyone help me to solve the following issue in the code:

1 vue (au cours des 30 derniers jours)
jaah navi
jaah navi le 10 Juin 2019
Clôturé : MATLAB Answer Bot le 20 Août 2021
code:
a=[ 3.9035 4.4602 4.6417 3.8581 4.0078;
4.2688 4.4651 3.8681 4.2601 3.8822;
4.6194 4.8077 4.6557 4.3956 4.3355;
3.3370 3.2847 2.6785 1.8889 2.8545;
4.0078 4.1569 3.3823 4.2836 3.9759;
4.5405 4.5808 4.1582 4.4091 3.9926;
4.5001 4.4627 4.3847 4.5679 4.6857;
4.5029 4.4628 4.3840 4.5673 4.6851;
2.7984 3.0607 3.2420 3.2805 3.0148]
[~, roworder] = sort(a, 1, 'descend')
with respect to the code i need to arrange it in descending order.
when i run the code it gives the following result
roworder =
3 3 3 7 7
6 6 1 8 8
8 2 7 6 3
7 8 8 3 1
2 7 6 5 6
5 1 2 2 5
1 5 5 1 2
4 4 9 9 9
9 9 4 4 4
but with respect to the first column 4.6194 is the largest number and its place needs to be displayed by 1,when i run the code it displays 1 in the place of 4.5001 which is smaller when compared with 4.6194.could anyone please help me on this.
  3 commentaires
jaah navi
jaah navi le 10 Juin 2019
Yes correct.Sorry for the trouble I misunderstood it.
KSSV
KSSV le 10 Juin 2019
USe:
[b, roworder] = sort(a, 1, 'descend') ;
b

Réponses (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by