To set a default property that all shapes will use, you must set this default value for the root object . Here is more detailed documentation explaining how to do this. In your case, you will do the following:
set(0,'DefaultFigureColormap',cmap);
In general, the name of the property you must set is the word 'Default' , followed by the name of the handle object (i.e. 'Figure' , 'Line' , 'Surface' , etc.), followed by the name properties for the default installation. After installation, subsequent descriptor objects will be created with the specified property specified by default.
Note. The default property values you set will only be saved for the current MATLAB session. If you restart MATLAB, the default values will revert to factory settings. To use the same default values every time you start MATLAB, apply them in the file 'startup.m' .
source share