Monday, July 27, 2015

For Imagesc, plot water/nan with different color

Figure plot with the lowest value set as distinct colormap.
 figure; imagesc(Temperature)

icol =  colormap;
icol(1,:) = [0 0 0]; % or 111 for white
colormap(icol);

Monday, July 20, 2015

isleapyear function matab

Is it a leapyear?
isleapyear = @(yr) (datenum(yr+1,1,1)-datenum(yr,1,1))==366;
isleapyear(1900)