Effacer les filtres
Effacer les filtres

"See" max 2nd-to-max values per column (by coloring entry)

1 vue (au cours des 30 derniers jours)
Dave
Dave le 26 Août 2019
Hello, is there a way to "see" the max and second-to-max by columns in a 100x20 array? If, so, where would you see it? I understand array entries do not allow for color.Goal is to be able to quickly look if maxs are concentrated around a specific row.
This is similar to excel's conditional formatting where it paints a cell based on a condition
Thanks

Réponses (1)

Walter Roberson
Walter Roberson le 26 Août 2019
Create an 100x20 uint8 array. Assign 0 to the locations that are not the two max. Assign 1 to the locations that are the second maximas. Assign 2 to the locations that are the maximas.
Now image() the array, and invoke a colormap() of three colors, with the first row indicating the color for the entries that are not maxima, with the second row indicating the color for the entries that are the second maxima, and with the third row indicating the color for the entries that are the main maxima.
When you do this, pay attention to whether you want the high row numbers to appear at the top of the screen (YDir 'reverse' is default for image()) or at the bottom of the screen (YDir 'normal')
In the special case where you do not want to distinguish between maxima and second maxima, then you can create a logical array that is true for the maxima and second maxima. Then spy() the array.

Catégories

En savoir plus sur Red dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by