The datetick doesn't work well for plotyy due to two different axis properties. This script use for plotyy instead of datetick with one more input as
% haxes = plotyy(x1,y1,x2,y2)
It basically same to datetick expect additional axes information input.
Nobuhito Mori (2021). datetick2 (https://www.mathworks.com/matlabcentral/fileexchange/26645-datetick2), MATLAB Central File Exchange. Retrieved .
Perhaps you want to change the name of this file to "datetickyy" or something similar. There is already a "datetick2" file (http://www.mathworks.com/matlabcentral/fileexchange/20422-datetick-with-zooming-panning-and-subplots) which I use frequently. Thanks for writing this script, it should be useful.
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!