https://www.mathworks.com/matlabcentral/fileexchange/31711-zero-order-hold-with-variable-time-step?s_tid=blogs_rc_5
Zero Order Hold with variable time step - File Exchange - MATLAB Central
Download and share free MATLAB code, including functions, models, apps, support packages and toolboxes
zero order holdtime stepfile exchangevariable