% Channel ID to read data from readChannelID = 772570; % Channel Read API Key readAPIKey = 'G69NOS1HEH299SKP'; % One day date range dateRange = [datetime('today','TimeZone','Europe/Paris') datetime('now','TimeZone','Europe/Paris')]; % Read data including the timestamp [data,time] = thingSpeakRead(readChannelID,'Fields',1:3,'DateRange',dateRange); % Create variables to store different sorts of data vent_mini_jour = data(:,1); vent_moyen_jour = data(:,2); vent_maxi_jour = data(:,3); time1=time + hours(2) % GRAPHE v(1)=plot(time1, vent_moyen_jour,':r','LineWidth',3) % Plot hold on % coloriage des zones fill([xlim fliplr(xlim)], [20 20 50 50], 'r', 'LineStyle', 'none', 'FaceAlpha', 0.5) % Highlight the uncomfortable zone %text(40, 35, num2str(vent_maxi_jour(end)),'FontSize', 8, 'FontWeight', 'normal') fill([xlim fliplr(xlim)], [0 0 20 20], 'g', 'LineStyle', 'none', 'FaceAlpha', 0.9) % Highlight the comfortable zone %text(0, 25, 'Pas de vent') % Add text for the zone %essai v(2)=area(time1, vent_maxi_jour) v(3)=area(time1, vent_mini_jour) v(2).FaceColor = [0 0.1 1]; v(3).FaceColor = [0 1 0]; uistack(v(1),'top'); %fin d'essai xlabel('Heure') ylabel('Vitesse du vent (Km/h)') ylim([0 40]) xlim([time1(35) time1(end)]) yticks(0:5:40); title(sprintf('%s : MOY= %d, MIN= %d, MAX= %d (Km/h) \n', datestr(time1(end),'dd/mm/yy HH:MM'), vent_moyen_jour(end), vent_mini_jour(end), vent_maxi_jour(end)),'FontSize', 8, 'FontWeight', 'normal') set(gcf,'position',[0,0,800,800]) ax=gca ax.XAxis.FontSize = 8; ax.YAxis.FontSize = 8; hold off