I have a one-column array that I would like to sort in descending order. The array has values ranging from 0 to approximately 10^14. When I sort the array with
sorted = sort(A,'descend')
and try to look at the ten largest values, I find that
sorted(1:10)
gives me
1.0e+14 *
5.1093
0.0000
0.0000
0.0000
etc… — Displaying these first few, large entries tells me that there’s only one non-zero element, which isn’t true.
However, if I skip the first couple of entries, which are far greater than the rest of the array elements, I get
sorted(8:10) =
2.9754
2.4182
2.0799
Why does displaying these first few large array elements cause all others to be displayed as zero?
The first number in your list is a scale factor that multiplies the entire array that follows. Because of the difference in magnitude of the elements, you will need to play with the format settings. Try
or
to see a better representation