MATLAB: Put the name in the “x axis” of the graph bar every five days or seven days

bardaysgraphgraphbarirradiatondatanamegraphoverlaptexttext;xlim

Hi, i hope all of you have a wonderful day, i have the matlab R2019a, and i want a simply thing, put the name of the days every five days or seven days to dont overlap the names of the days, because i can't see what day it is. I think is a very simple thing , but i can't find how to do it. i want to find the way to is easy to see the names
Thanks in advance..
Ana S
This is my code:
clear;clc;
numData = xlsread('enerosolar.xlsx','EneDic')
Dia = numData(:,1);
Rad = numData(:,2);
figure;
bar(Dia,'b')
xlabel('Día de Julio 2014')
ylabel('Irradiación Solar Global [KWh/m^2]');
xticks(1:1:length(Rad)) % This will set how many ticks you want on the x-axis. Here, there should be 48 ticks being generated. One for each piece of data you have.
xtickangle(90) % This will rotate the label so that the labels will not overlap with one another. This is in degrees.
xlim([0:5:31])
% perc = hline(4.43,'r', 'Días parcialmente nublados'); hold on

Best Answer

Don't put the ticks every day; that's the cause for there being that many--you did it to yourself! :)
The bar() command will put ticks at convenient places automagically, if you don't like those you can then put them where want.
Use xticklabel to write something besides the tick value.
If you would convert to use datetime, you could get the day string for free...
ADDENDUM:
Sorry, got sidetracked and didn't get back when thought would/could...
It's relatively simple to use dates for the x axis and then the datetime ruler object gives you a lot of flexibility for dates --I'll also demonstrate the new(ish) MATLAB table object in lieu of the old xlsread route...
tEnersol=readtable('enerosolar.xlsx','Sheet','EneDic'); % read into a table object
tEnersol.Properties.VariableNames={'Rad','Dia'}; % assign variable names
yr=2014; % need the proper year
tEnersol.Date=datetime(yr,1,tEnersol.Dia); % and create a date column
hB=bar(tEnersol.Date,tEnersol.Rad); % bar plot against actual date
hAx=gca; % get axes handle...
xlim([datetime(2014,1,1) datetime(2015,1,1)]) % set limit to cover the full year
hAx.XAxis.TickLabelFormat='eee'; % show day of week
produced
which you'll note doesn't have the same shape as yours as it is plotted using the actual date in the data file on the x axis, not against ordinal position in the file (which is not ordered by date). This will show up if change the time format on the x-axis to 'MMM'
which illustrates the data must be from somewhere in the northern hemisphere.