Search code examples
matlabplotmatlab-guideaxes

Calling dateaxis function using handles in MATLAB


As you know we can call different plotting functions using MATLAB handles like:

plot(handles.axes,data);
hold(handles.axes,'on')
plot(handles.axes,ab2,data2,':r');
title(handles.axes','my title');
legend(handles.axes,'mm','ab','Location','Best');
grid on;
ylabel(handles.axes,'y label);

How we can call dateaxis function using handles? I want convert my x-axes values to dates. dateaxis(handles.axes,12) didn't work.


Solution

  • You likely want to use datetick, which allows you to specify the axes to which you wish to apply changes in the same way as with plot:

    datetick(axes_handle,...)