How to label x-axis in MMDDYY format instead of DDD

How can i change the date format on the x-axis from days( Mon, Tues, Wed, etc.) to the date(8/21/22, 8/22/22, etc.)?

“datetick” already changed the format from 4.4801e+04 to a day of the week, but i need it to show the date.

Does this help?

xticklabels (cellstr (datestr (now + (-50:50), "yyyymmdd")))

You’ll have to change the format string to what you need. Look at help datestr for more formats.

Yes, this did help to some extent. While it did change the X axis to dates, it did not change to the “expected” dates. The dates it changed to are *8/1/2022, 8/2/2022, etc. From the data that I imported using “xlsread” it should have been 8/21/2022, 8/22/2022, etc, through 8/27/2022.

I don’t know your exact data but it seems to span 7 days from 8/21/2022 - 8/27/2022. Here’s an example of using datetick to formate the x-axis.

xdata = datenum (2022, 8, 21:27);
ydata = 1:7;
plot (xdata, ydata, "+-")
datetick ('x', "mm/dd/yyyy");

There is some strangeness with the plot routine and large values. I think you will be better off normalizing the data, plotting it, and using xticklabels. Sample data flow:

xdata = datenum (2022, 8, 21:27);
xndata = xdata - min (xdata);
ydata = 1:7;
plot (xndata, ydata, "+-");
xticklabels (cellstr (datestr (xdata, "mm/dd/yyyy")));

This has accomplished what I was looking to do. Thank you very much!