issue with colormap (colorcube)
4 visualizaciones (últimos 30 días)
DGM el 23 de En. de 2023
From the R2019b release notes:
Predefined colormaps have 256 colors by default
The predefined colormaps, such as parula, jet, and winter, now have 256 colors by default. If you have code that depends on a predefined colormap having 64 colors, specify the number of colors when you set the colormap for the figure, axes, or chart. For example, colormap(parula(64)) sets the figure's colormap to the 64-color parula colormap. Alternatively, you can change the default colormap for all figures within your MATLAB session:
In fact, the map generation routine itself has not changed. The only thing that's changed is how the various colormap functions determine the map length to use when none is explicitly given. This does not affect cases where the colormap length is specified explicitly.
The RN implies that the legacy behavior can be recreated by specifying a map length of 64. While that might work to adapt code which has otherwise not changed, it's important to understand that the behavior didn't simply change from "always default to 64" to "always default to 256".
In either version, if there is an open figure with a colormap set, the behavior of functions like colorcube()/jet(), etc is to create a map that's the same length as whatever the current colormap is -- regardless of whatever the defaults are. If you aren't explicitly specifying the map length when you use the colormap generation tools, you have no reliable control over what size map you get. Your code is not merely dependent on the version, but whatever potentially unrelated code ran before it. Specify the map length.
Bjorn Gustavsson el 22 de Dic. de 2022
Check that/if/how the two m-files differ. If they differ, copy the one you like better to the other system into a directory you have at the top of the matlab-path. Since you have licenses for the two versions this should be fine (I have no idea about how restrictively and draconicaly the copyright-rules can be applied). Since a colormap-function is not too foundational I have a hard time imagining a scenario where this would break some other functionality in the system where you add the other colorcube function. I might even consider adapting the function-name to something like best_colorcube.m, just to avoid any shadowing.
Others might have more formal advice on the legalities and system interference.