Coming back here a bit over a year later I though I'd give answeres to my own questions :) just in case anyone else needs doing the same things and is having the same struggles I had.
The script uses DynamicDateTicks by Ameya Deoras to do most of the work. Here is how I did it (I've reduced a lot of my code, and added extra comments, just to make is easier to understand):
% atm_temperature_value.Value and atm_pressure_value.Value are my live feed values acquired from the sensors
% If you want to test my code you'll have to attach these values to something else (you could use a RNG within the loop)
% The same has to be done for Forecast_Temperature and Forecast_Pressure arrays, as they are the result of the forecasting process
%% CREATE A FIGURE TO VISUALISE THE PLOTS
f = figure('Name', 'Live Data Feed', 'Position', [50 350 1800 600]);
Tx = subplot(2,5,1); % Temperature Subplot X axis
T_Line = animatedline('Color',[1.000 0.000 0.000],'LineWidth',2); % the line animating the live (main) feed of data in red
TF_Line = animatedline('Color',[1.000 0.000 0.000], 'LineWidth',4, 'DisplayName',' 0.1'); % the animated line of the second (predicted) data set (thiker red line with reduced opacity)
TF_Line.Color(4) = 0.1; % Reduced opacity for the second (prediction) line
Px = subplot(2,5,2); % Pressure Subplot
P_Line = animatedline('Color',[0.812 0.573 0.000],'LineWidth',2); % Orange
PF_Line = animatedline('Color',[0.812 0.573 0.000], 'LineWidth',4, 'DisplayName',' 0.1');
PF_Line.Color(4) = 0.1;
% An axis array for all data subplot's X axis to be updated and visualised as date time format
All_Axes = [Tx Px]; % Add all subplot's X axes to this array
% SET TIME FOR THE CYCLE (AND FINISH THE EXPERIMENT)
stopTime = '03/26 17:33'; % MM/DD Time
count = 1; % Cycle counter
while ~isequal(datestr(now,'mm/DD HH:MM'),stopTime)
%% UPDATE THE ANIMATED LINES
% Get the current time
t = datetime('now');
addpoints(T_Line,datenum(t),atm_temperature_value.Value); % Plot real-time temperature value (from the sensor) to the T_Line on Tx axis
addpoints(P_Line,datenum(t),atm_pressure_value.Value); % Plot real-time pressure value (from the sensor) to the P_Line on Px axis
%% SOME CODE HERE TO FORECAST NEXT (N) PERIOD EVERY (M) SECONDS
% Forecast_Temperature and Forecast_Pressure arrays are the result of this action
% Build extended time array (N seconds into the future)
% with 1 seconds step interval
for i=1:N
ForecastTime(1,i) = addtodate(datenum(t), i, 'second');
end
% Plot Forecasted Values
addpoints(TF_Line,ForecastTime(1,N),Forecast_Temperature(1,N)); % Adds the forcasted values to the Temperature subplot, but uses the forecasted line features.
addpoints(PF_Line,ForecastTime(1,N),Forecast_Pressure(1,N)); % The same for the Pressure.
drawnow
%% UPDATE X AXES ON ALL SUBPLOTS
Tx.XLim = datenum([t-seconds(N) t+seconds(N)]);
Px.XLim = datenum([t-seconds(N) t+seconds(N)]);
dynamicDateTicks(All_Axes, 'HH:MM:SS') % Uses the array of all X axis
drawnow
%% END ITTERATION
pause(1);
count = count +1;
end
disp('END');
I'm not sure how clear I've made this, but hopefully it is helpfull to someone. :)
Cheers!