change in time in matlab

Matlab has several functions that can be used to manipulate time data. Here are a few examples:

  1. datetime: This function creates a datetime array from numeric or character arrays.
main.m
mydate = datetime('now');
26 chars
2 lines
  1. datestr: This function converts a date and time to a character vector.
main.m
mydate = datetime('now');
mystr = datestr(mydate);
51 chars
3 lines
  1. datenum: This function converts a date and time to a serial date number.
main.m
mydate = datetime('now');
myserial = datenum(mydate);
54 chars
3 lines
  1. Manipulating a datetime array:
main.m
mydate = datetime('now');
mydate.Hour = mydate.Hour + 1;
57 chars
3 lines

These are just a few examples of the many functions available for manipulating time data in Matlab.

gistlibby LogSnag