MATLAB: How to plot two figures in one figure with different axes

plotting

I am trying to plot flows collected in different time of the day for different days in the same plot. As the moments of collection are not exactly the same for each day the second plot is drawn in the continues of the first one:
whle I need them something like this:

Best Answer

  • Simply replace the line:
    date2 = datenum(year2, month2, day2, hour2, min2, sec2);
    by
    date2 = datenum(year1, month1, day1, hour2, min2, sec2);
    Then the data will use the same day.